Guest User

Untitled

a guest
Jan 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. <?php
  2. $hasLabel = true;
  3. $hasErrors = false;
  4. $required = false;
  5.  
  6. if ($this->element->helper == 'formSubmit') {
  7. $this->class .= ' no-label submit-button';
  8. $hasLabel = false;
  9. }
  10. if (count($this->element->getMessages()) > 0) {
  11. $this->class .= ' errors';
  12. $hasErrors = true;
  13. }
  14. if ($this->element->isRequired()) {
  15. $this->class .= ' required';
  16. $required = true;
  17. }
  18. if ($this->element->disabled == true) {
  19. $this->class .= ' disabled';
  20. }
  21. ?>
  22.  
  23. <?php if ($this->element->helper == 'formHidden'): ?>
  24. <?php echo $this->{$this->element->helper}(
  25. $this->element->getName(),
  26. $this->element->getValue(),
  27. $this->element->getAttribs()
  28. ) ?>
  29. <?php else: ?>
  30.  
  31. <div id="<?php echo $this->element->getName(); ?>-wrapper" class="form-item-wrapper <?php echo $this->class; ?>">
  32.  
  33. <div class="label-and-element">
  34. <?php if ($hasLabel): ?>
  35. <div class="label">
  36. <?php echo $this->formLabel($this->element->getName(), $this->element->getLabel()); ?>:
  37. </div>
  38. <?php endif; ?>
  39. <div class="element">
  40. <?php
  41. // var_dump($this->element->helper);
  42. switch ($this->element->helper) {
  43. case 'formMultiCheckbox':
  44. echo $this->{$this->element->helper}(
  45. $this->element->getName(),
  46. $this->element->getValue(),
  47. $this->element->getAttribs(),
  48. $this->element->getMultiOptions()
  49. );
  50. break;
  51. case 'formCheckbox':
  52. echo $this->{$this->element->helper}(
  53. $this->element->getName(),
  54. $this->element->getValue(),
  55. $this->element->getAttribs(),
  56. array(
  57. 'uncheckedValue' => $this->element->getUncheckedValue(),
  58. 'checkedValue' => $this->element->getCheckedValue())
  59. );
  60. break;
  61. case 'formSubmit':
  62. if ($this->element->getLabel() == 'Cancel') {
  63. $this->element->setAttrib('class', 'colourbutton cancel');
  64. } else {
  65. $this->element->setAttrib('class', 'colourbutton cta');
  66. }
  67. echo $this->{$this->element->helper}(
  68. $this->element->getName(),
  69. $this->element->getLabel(),
  70. $this->element->getAttribs()
  71. );
  72. break;
  73. case 'formSelect':
  74. echo $this->{$this->element->helper}(
  75. $this->element->getName(),
  76. $this->element->getValue(),
  77. $this->element->getAttribs(),
  78. $this->element->getMultiOptions(),
  79. $this->element->getSeparator()
  80. );
  81. break;
  82. default:
  83. echo $this->{$this->element->helper}(
  84. $this->element->getName(),
  85. $this->element->getValue(),
  86. $this->element->getAttribs()
  87. );
  88. break;
  89. }
  90.  
  91. ?>
  92. </div>
  93. <!-- <div class="clear"></div> -->
  94. </div>
  95.  
  96. <?php if ($hasErrors): ?>
  97. <div class="help withErrors">
  98. <div class="description">
  99. <?php echo $this->element->getDescription(); ?>
  100. </div>
  101. <div class="errors">
  102. <?php echo $this->formErrors($this->element->getMessages()); ?>
  103. </div>
  104. </div>
  105. <?php elseif ($this->element->getDescription() != ''): ?>
  106. <div class="help">
  107. <div class="description">
  108. <?php echo $this->element->getDescription(); ?>
  109. </div>
  110. </div>
  111. <?php endif; ?>
  112. <!-- <div class="clear"></div> -->
  113. </div>
  114. <?php endif; ?>
Add Comment
Please, Sign In to add comment