示例#1
0
 /**
  * {@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);
 }
示例#2
0
文件: Panel.php 项目: coolms/twbs
 /**
  * @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);
 }
示例#3
0
文件: Label.php 项目: coolms/common
 /**
  * {@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);
 }
示例#4
0
 /**
  * {@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);
 }
示例#5
0
 /**
  * @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);
 }