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); }
/** * Render options * * @param MultiCheckboxElement $element * @param array $options * @param array $selectedOptions * @param array $attributes * @return string */ protected function renderOptions(MultipleChoice $element, array $options, array $selectedOptions, array $attributes) { $question = $element->getQuestion(); $header = $element->getHeader(); $content = "<dd><pre>" . $this->getView()->escapeHtml($question) . "</pre></dd>"; $content .= "<dl>{$header}</dl>"; $content .= parent::renderOptions($element, $options, $selectedOptions, $attributes); return $content; }
/** * @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>'; }
/** * Multi checkbox * * @param ElementInterface|null $element * @param null $labelPosition * @return string|Helper\FormMultiCheckbox */ public function multiCheckbox(ElementInterface $element = null, $labelPosition = null) { $helper = new Helper\FormMultiCheckbox(); return $helper->__invoke($element, $labelPosition); }