/** * @return HtmlContainer */ protected function getFormControlStatusHelper() { if ($this->formControlStatusHelper) { return $this->formControlStatusHelper; } if (!$this->formControlStatusHelper instanceof HtmlContainer) { $this->formControlStatusHelper = new HtmlContainer(); $this->formControlStatusHelper->setView($this->getView()); } $this->formControlStatusHelper->setTagName('span')->setAttribute('class', 'sr-only'); return $this->formControlStatusHelper; }
/** * {@inheritDoc} * * @param ElementInterface $element * @param FormInterface $form */ public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null) { $legendHelper = $this->getLegendHelper(); if ($legendHelper instanceof TranslatorAwareInterface) { $rollbackTextDomain = $legendHelper->getTranslatorTextDomain(); $legendHelper->setTranslatorTextDomain($this->getTranslatorTextDomain()); } $content = $legendHelper($element, [], $element, $form) . $content; if (isset($rollbackTextDomain)) { $legendHelper->setTranslatorTextDomain($rollbackTextDomain); } return parent::render($content, $attribs); }
/** * @param string $content * @param array $attribs * @param string $header * @param string $footer * @return string */ public function render($content, array $attribs = [], $header = null, $footer = null) { $markup = ''; if ($header) { $markup .= sprintf($this->headingOpenTag, $this->htmlAttribs($this->headingAttributes)); $markup .= $header; $markup .= $this->headingCloseTag; } $markup .= sprintf($this->bodyOpenTag, $this->htmlAttribs($this->bodyAttributes)); $markup .= $content; $markup .= $this->bodyCloseTag; if ($footer) { $markup .= sprintf($this->footerOpenTag, $this->htmlAttribs($this->footerAttributes)); $markup .= $footer; $markup .= $this->footerCloseTag; } return parent::render($markup, $attribs); }
/** * {@inheritDoc} * * @param ElementInterface $element */ public function render($content, array $attribs = [], ElementInterface $element = null) { if ($content instanceof LabelAwareInterface) { $content = $content->getLabel(); } elseif ($element instanceof LabelAwareInterface) { $content = $element->getLabel(); } if (is_string($content) && $this->hasTranslator() && $this->isTranslatorEnabled()) { $content = $this->getTranslator()->translate($content, $this->getTranslatorTextDomain()); } if ($element instanceof FormInterface && ($object = $element->getObject()) && method_exists($object, '__toString')) { $content = sprintf($content, $object); } if ($element && (!$element instanceof LabelAwareInterface || !$element->getLabelOption('disable_html_escape'))) { $escapeHtmlHelper = $this->getEscapeHtmlHelper(); $content = $escapeHtmlHelper($content); } return parent::render($content, $attribs); }
/** * {@inheritDoc} */ public function __invoke($content = null, array $attribs = []) { if (0 === func_num_args()) { return $this; } if (!is_scalar($content)) { throw new \InvalidArgumentException(sprintf('%s expects a scalar value, "%s" given', __METHOD__, is_object($content) ? get_class($content) : gettype($content))); } if (!($content = trim($content))) { return ''; } if (strpos($content, $this->defaultClass . '-') !== 0) { $content = $this->defaultClass . '-' . $content; } if (!empty($attribs['class']) && !preg_match('/(\\s|^)' . preg_quote($content, '/') . '(\\s|$)/', $attribs['class'])) { $attribs['class'] .= ' ' . $content; } elseif (empty($attribs['class'])) { $attribs['class'] = $content; } return parent::__invoke('', $attribs); }
/** * {@inheritDoc} */ public function render($content, array $attribs = []) { if (!$content) { /* @var $fm FlashMessenger */ $fm = $this->getFlashMessengerHelper(); if ($fm->hasMessages()) { $content .= $fm->render(); } if ($fm->hasInfoMessages()) { $content .= $fm->render(FlashMessengerPlugin::NAMESPACE_INFO); } if ($fm->hasSuccessMessages()) { $content .= $fm->render(FlashMessengerPlugin::NAMESPACE_SUCCESS); } if ($fm->hasWarningMessages()) { $content .= $fm->render(FlashMessengerPlugin::NAMESPACE_WARNING); } if ($fm->hasErrorMessages()) { $content .= $fm->render(FlashMessengerPlugin::NAMESPACE_ERROR); } } return parent::render($content, $attribs); }
/** * @param string|ElementInterface $content * @param array $attribs * @param ElementInterface $element * @param FormInterface $form * @return string */ public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null) { return parent::render($content, $attribs); }