Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hasLabel = true;
- $hasErrors = false;
- $required = false;
- if ($this->element->helper == 'formSubmit') {
- $this->class .= ' no-label submit-button';
- $hasLabel = false;
- }
- if (count($this->element->getMessages()) > 0) {
- $this->class .= ' errors';
- $hasErrors = true;
- }
- if ($this->element->isRequired()) {
- $this->class .= ' required';
- $required = true;
- }
- if ($this->element->disabled == true) {
- $this->class .= ' disabled';
- }
- ?>
- <?php if ($this->element->helper == 'formHidden'): ?>
- <?php echo $this->{$this->element->helper}(
- $this->element->getName(),
- $this->element->getValue(),
- $this->element->getAttribs()
- ) ?>
- <?php else: ?>
- <div id="<?php echo $this->element->getName(); ?>-wrapper" class="form-item-wrapper <?php echo $this->class; ?>">
- <div class="label-and-element">
- <?php if ($hasLabel): ?>
- <div class="label">
- <?php echo $this->formLabel($this->element->getName(), $this->element->getLabel()); ?>:
- </div>
- <?php endif; ?>
- <div class="element">
- <?php
- // var_dump($this->element->helper);
- switch ($this->element->helper) {
- case 'formMultiCheckbox':
- echo $this->{$this->element->helper}(
- $this->element->getName(),
- $this->element->getValue(),
- $this->element->getAttribs(),
- $this->element->getMultiOptions()
- );
- break;
- case 'formCheckbox':
- echo $this->{$this->element->helper}(
- $this->element->getName(),
- $this->element->getValue(),
- $this->element->getAttribs(),
- array(
- 'uncheckedValue' => $this->element->getUncheckedValue(),
- 'checkedValue' => $this->element->getCheckedValue())
- );
- break;
- case 'formSubmit':
- if ($this->element->getLabel() == 'Cancel') {
- $this->element->setAttrib('class', 'colourbutton cancel');
- } else {
- $this->element->setAttrib('class', 'colourbutton cta');
- }
- echo $this->{$this->element->helper}(
- $this->element->getName(),
- $this->element->getLabel(),
- $this->element->getAttribs()
- );
- break;
- case 'formSelect':
- echo $this->{$this->element->helper}(
- $this->element->getName(),
- $this->element->getValue(),
- $this->element->getAttribs(),
- $this->element->getMultiOptions(),
- $this->element->getSeparator()
- );
- break;
- default:
- echo $this->{$this->element->helper}(
- $this->element->getName(),
- $this->element->getValue(),
- $this->element->getAttribs()
- );
- break;
- }
- ?>
- </div>
- <!-- <div class="clear"></div> -->
- </div>
- <?php if ($hasErrors): ?>
- <div class="help withErrors">
- <div class="description">
- <?php echo $this->element->getDescription(); ?>
- </div>
- <div class="errors">
- <?php echo $this->formErrors($this->element->getMessages()); ?>
- </div>
- </div>
- <?php elseif ($this->element->getDescription() != ''): ?>
- <div class="help">
- <div class="description">
- <?php echo $this->element->getDescription(); ?>
- </div>
- </div>
- <?php endif; ?>
- <!-- <div class="clear"></div> -->
- </div>
- <?php endif; ?>
Add Comment
Please, Sign In to add comment