/** * Render a collection by iterating through all fieldsets and elements * * @param ElementInterface $element * @return string */ public function render(ElementInterface $element, $wrap = false) { if (!$element instanceof Collection) { $helper = $element instanceof FieldsetInterface ? $this->getFieldsetHelper() : $this->getElementHelper(); return $helper($element); } $markup = parent::render($element); if ($wrap) { $attrs = $this->createAttributesString($element->getAttributes()); $markup = sprintf('<div%s>%s</div>', $attrs ? ' ' . $attrs : '', $markup); } return $markup; }
public function __invoke(ElementInterface $collection = null, $wrap = true) { if ($collection) { if ($collection->getOption('form-inline') || $this->hasClass($collection, 'form-inline')) { foreach ($collection as $element) { $element->setOption('form-inline', true); } } elseif ($collection->getOption('form-horizontal') || $this->hasClass($collection, 'form-hotizontal')) { $labelCols = (int) $collection->getOption('label-cols') ?: 3; $inputCols = (int) $collection->getOption('input-cols') ?: 12 - $labelCols; foreach ($collection as $element) { $options = array_merge($element->getOptions(), ['form-horizontal' => true, 'label-cols' => $labelCols, 'input-cols' => $inputCols]); $element->setOptions($options); } } } if (null !== ($shouldWrap = $collection->getOption('should_wrap'))) { $wrap = $shouldWrap; } return parent::__invoke($collection, $wrap); }
public function render(ElementInterface $element) { $fielset = parent::render($element); $replace = str_replace(array("<fieldset>", "</fieldset>"), "", $fielset); return $replace; }
/** * Only render a template * * @param CollectionElement $collection * @return string */ public function renderTemplate(CollectionElement $collection) { if ($sElementLayout = $collection->getOption('twb-layout')) { $elementOrFieldset = $collection->getTemplateElement(); $elementOrFieldset->setOption('twb-layout', $sElementLayout); } return parent::renderTemplate($collection); }
public function render(ElementInterface $oElement) { $name = Helper::camelCase($oElement->getName()); $allow_add = $oElement->getOption('allow_add'); $allow_remove = $oElement->getOption('allow_remove'); $class = $allow_add || $allow_remove ? "addremove" : ""; $addnew = $allow_add ? sprintf(self::$addNew, $name) : ""; $markup = $allow_add ? sprintf(self::$outputFormat, $addnew, parent::render($oElement), $class) : parent::render($oElement); return $markup; }
/** * @return \Zend\Form\View\Helper\FormElement */ protected function getElementHelper() { return parent::getElementHelper(); }
public function render(ElementInterface $element) { return sprintf('<table class="table table-condensed">%s</table>', parent::render($element)); }