getLabelPosition(); } if ($renderErrors !== null) { $this->setRenderErrors($renderErrors); } if ($partial !== null) { $this->setPartial($partial); } return $this->render($element, $labelPosition); } /** * Utility form helper that renders a label (if it exists), an element and errors * * @param ElementInterface $element * @param null|string $labelPosition * @throws \Zend\Form\Exception\DomainException * @return string */ public function render(ElementInterface $element, $labelPosition = null) { $escapeHtmlHelper = $this->getEscapeHtmlHelper(); $labelHelper = $this->getLabelHelper(); $elementHelper = $this->getElementHelper(); $elementErrorsHelper = $this->getElementErrorsHelper(); $label = $element->getLabel(); $inputErrorClass = $this->getInputErrorClass(); if (is_null($labelPosition)) { $labelPosition = $this->labelPosition; } if (isset($label) && '' !== $label) { // Translate the label if (null !== ($translator = $this->getTranslator())) { $label = $translator->translate($label, $this->getTranslatorTextDomain()); } } // Does this element have errors ? if (count($element->getMessages()) > 0 && !empty($inputErrorClass)) { $classAttributes = ($element->hasAttribute('class') ? $element->getAttribute('class') . ' ' : ''); $classAttributes = $classAttributes . $inputErrorClass; $element->setAttribute('class', $classAttributes); } if ($this->partial) { $vars = array( 'element' => $element, 'label' => $label, 'labelAttributes' => $this->labelAttributes, 'labelPosition' => $labelPosition, 'renderErrors' => $this->renderErrors, ); return $this->view->render($this->partial, $vars); } if ($this->renderErrors) { $elementErrors = $elementErrorsHelper->render($element); } $elementString = $elementHelper->render($element); // hidden elements do not need a