public function render(ElementInterface $element) { if (!$this->separator) { $this->separator = $this->closeTag() . $this->openTag($element); return $this->openTag($element) . parent::render($element) . $this->closeTag(); } return parent::render($element); }
/** * @see FormMultiCheckbox::render() * @param ElementInterface $oElement * @return string */ public function render(ElementInterface $oElement) { $aElementOptions = $oElement->getOptions(); // For inline multi-checkbox if (isset($aElementOptions['inline']) && $aElementOptions['inline'] == true) { $this->setSeparator(''); $oElement->setLabelAttributes(array('class' => 'checkbox-inline')); return sprintf('%s', parent::render($oElement)); } $this->setSeparator('</div><div class="checkbox">'); $oElement->setLabelAttributes(array('class' => 'checkbox')); return sprintf('<div class="checkbox">%s</div>', parent::render($oElement)); }
/** * @see \Zend\Form\View\Helper\FormMultiCheckbox::render() * @param \Zend\Form\ElementInterface $oElement * @return string */ public function render(\Zend\Form\ElementInterface $oElement) { $aElementOptions = $oElement->getOptions(); $sCheckboxClass = isset($aElementOptions['inline']) && $aElementOptions['inline'] == false ? 'checkbox' : 'checkbox-inline'; $aLabelAttributes = $oElement->getLabelAttributes(); if (empty($aLabelAttributes['class'])) { $aLabelAttributes['class'] = $sCheckboxClass; } elseif (!preg_match('/(\\s|^)' . $sCheckboxClass . '(\\s|$)/', $aLabelAttributes['class'])) { $aLabelAttributes['class'] .= ' ' . $sCheckboxClass; } $oElement->setLabelAttributes($aLabelAttributes); return parent::render($oElement); }
/** * @see \Zend\Form\View\Helper\FormMultiCheckbox::render() * @param \Zend\Form\ElementInterface $oElement * @return string */ public function render(\Zend\Form\ElementInterface $oElement) { $aElementOptions = $oElement->getOptions(); // For no inline multi-checkbox if ($bNoInline = isset($aElementOptions['inline']) && $aElementOptions['inline'] == false) { $sCheckboxClass = 'checkbox'; $this->setSeparator('</div><div class="checkbox">'); } else { $sCheckboxClass = 'checkbox-inline'; $this->setSeparator(''); } $oElement->setLabelAttributes(array('class' => $sCheckboxClass)); return $bNoInline ? '<div class="checkbox">' . parent::render($oElement) . '</div>' : parent::render($oElement); }
/** * Render a form <input> element from the provided $element * * @param ElementInterface $element * @throws Exception\InvalidArgumentException * @throws Exception\DomainException * @return string */ public function render(ElementInterface $element) { if ($element instanceof MultiCheckbox) { $options = $element->getValueOptions(); if (empty($options)) { if (($translator = $this->getTranslator()) !== null) { return '<i>' . $translator->translate('default.empty', 'default') . '</i>'; } else { return ''; } } } return '<div class="multi_checkbox">' . parent::render($element) . '</div>'; }