/** * Prepares the element prior to rendering * @param \Zend\Form\ElementInterface $element * @param string $formType * @param array $displayOptions * @return void */ protected function prepareElementBeforeRendering(ElementInterface $element, $formType, array $displayOptions) { if (array_key_exists('class', $displayOptions)) { $class = $element->getAttribute('class'); $class = $this->genUtil->addWords($displayOptions['class'], $class); $escapeHtmlAttrHelper = $this->getEscapeHtmlAttrHelper(); $class = $this->genUtil->escapeWords($class, $escapeHtmlAttrHelper); $element->setAttribute('class', $class); } $this->formUtil->addIdAttributeIfMissing($element); }
/** * Render a form <select> element from the provided $element * @param ElementInterface $element * @param null|string $formType * @param array $displayOptions * @return string */ public function render(ElementInterface $element, $formType = null, array $displayOptions = array()) { if (array_key_exists('class', $displayOptions)) { $class = $element->getAttribute('class'); $class = $this->genUtil->addWords($displayOptions['class'], $class); $escapeHtmlAttrHelper = $this->getEscapeHtmlAttrHelper(); $class = $this->genUtil->escapeWords($class, $escapeHtmlAttrHelper); $element->setAttribute('class', $class); } if (array_key_exists('size', $displayOptions)) { $element->setAttribute('size', (int) $displayOptions['size']); } $this->formUtil->addIdAttributeIfMissing($element); $html = parent::render($element); return $html; }
/** * Prepares the element prior to rendering * @param \Zend\Form\ElementInterface $element * @param string $formType * @param array $displayOptions * @return void */ protected function prepareElementBeforeRendering(ElementInterface $element, $formType, array $displayOptions) { $this->formUtil->addIdAttributeIfMissing($element); }