/modules/DefaultModule/views/form/wrapper/ul.html.php

https://github.com/tquensen/QF2 · PHP · 25 lines · 20 code · 5 blank · 0 comment · 27 complexity · 8fa5d192c089b3f1b5cc10347dc3275a MD5 · raw file

  1. <?php $inList = false; ?>
  2. <?php foreach ($form->getElements() as $currentElement): ?>
  3. <?php if ($currentElement->getType() == 'hidden') { continue; }; ?>
  4. <?php if ((in_array($currentElement->getType(), array('fieldset', 'fieldsetend')) || ($currentElement->getType() == 'custom' && $currentElement->useWrapper == false)) && $inList): $inList = false; ?>
  5. </ul>
  6. <?php endif; ?>
  7. <?php if (!in_array($currentElement->getType(), array('fieldset', 'fieldsetend')) && ($currentElement->getType() != 'custom' || $currentElement->useWrapper == true)): ?>
  8. <?php if (!$inList): $inList = true; ?>
  9. <ul>
  10. <?php endif; ?>
  11. <li id="<?php echo htmlspecialchars($form->getName())?>__<?php echo htmlspecialchars($currentElement->getName())?>__wrapper" class="formWrapper form<?php echo ucfirst($currentElement->getType())?>Wrapper<?php if (!$currentElement->isValid()):?> invalid<?php elseif($form->wasSubmitted()): ?> valid<?php endif; ?><?php if ($currentElement->wrapperClass): ?> <?php echo $currentElement->wrapperClass; ?><?php endif; ?><?php if ($currentElement->required): ?> <?php echo 'required'; ?><?php endif; ?>" <?php if ($currentElement->wrapperAttributes): foreach ((array) $currentElement->wrapperAttributes as $attr => $attrValue): ?> <?php echo ' '.$attr.'="'.$attrValue.'"'; ?><?php endforeach; endif; ?>>
  12. <?php endif; ?>
  13. <?php echo $this->parse('DefaultModule', 'form/' . $currentElement->getType(), array('element' => $currentElement)); ?>
  14. <?php if ($currentElement->info):?><span class="formInfo"><?php echo htmlspecialchars($currentElement->info)?></span><?php endif; ?>
  15. <?php if (!$currentElement->isValid() && !$currentElement->globalErrors):?><span class="formError"><?php echo htmlspecialchars($currentElement->errorMessage)?></span><?php endif; ?>
  16. <?php if (!in_array($currentElement->getType(), array('fieldset', 'fieldsetend')) && ($currentElement->getType() != 'custom' || $currentElement->useWrapper == true)): ?>
  17. </li>
  18. <?php endif; ?>
  19. <?php endforeach; ?>
  20. <?php if ($inList): ?></ul><?php endif; ?>