Exemple #1
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if ($class = $this->getElementStateClass($element, $form)) {
         $attribs = array_merge_recursive(compact('class'), $attribs);
     }
     return parent::render($content, $attribs, $element, $form);
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if (!$content && !($content = $element->getOption('description'))) {
         return '';
     }
     return parent::render($content, $attribs, $element, $form);
 }
Exemple #3
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if ($element) {
         $element->setOption('input_group', true);
     }
     return parent::render($content, $attribs, $element, $form);
 }
Exemple #4
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if (!$content && !$form) {
         return '';
     }
     if (!$form || !$element) {
         return parent::render($content, $attribs);
     }
     $content = $content ?: $this->getFeedbackContent($element, $form);
     if (!$content) {
         return '';
     }
     if (strpos($element->getAttribute('class'), 'form-control') !== false && ($element instanceof Element\Text || $element instanceof Element\Password || $element instanceof Element\Number || $element instanceof Element\Email || $element instanceof Element\Url)) {
         $element->setOption('has_feedback', true);
         if (empty($attribs['aria-hidden'])) {
             $attribs['aria-hidden'] = 'true';
         }
     }
     $feedbackHelper = $this->getFeedbackHelper();
     $content = $feedbackHelper($content, $this->mergeAttributes($attribs));
     if ($element->hasAttribute('aria-describedby') && ($status = $this->getStatusContent($element, $form))) {
         $formControlStatusHelper = $this->getFormControlStatusHelper();
         $content .= $formControlStatusHelper("({$status})", ['id' => $element->getAttribute('aria-describedby')]);
     }
     return $content;
 }
Exemple #5
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if (!$this->isElementHasError($element, $form)) {
         return '';
     }
     if (!$content) {
         $formElementErrorsHelper = $this->getFormElementErrorsHelper();
         $content = $formElementErrorsHelper($element, $this->mergeAttributes($attribs));
     }
     return parent::render($content, $attribs, $element, $form);
 }
Exemple #6
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if (!$content) {
         $elementDescriptionDecorator = $this->getElementDescriptionDecorator();
         $elementErrorsDecorator = $this->getElementErrorsDecorator();
         $content = $elementDescriptionDecorator(null, ['class' => 'form-control-description'], $element, $form) . $elementErrorsDecorator(null, [], $element, $form);
         if (!$content) {
             return '';
         }
     }
     return parent::render($content, $attribs, $element, $form);
 }
Exemple #7
0
 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if (is_string($content) && $element && $form) {
         $elements = $this->getFieldsetElements($element, $form);
         if (isset($elements[$content])) {
             $content = $elements[$content];
         }
     }
     if ($content instanceof ElementInterface) {
         $content->setAttributes($this->mergeAttributes($attribs));
         if (!$content->hasAttribute('id')) {
             $idNormalizer = $this->getIdNormalizer();
             $content->setAttribute('id', $idNormalizer($content->getName()));
         }
         if ($content instanceof FieldsetInterface) {
             $rendered = $this->renderHelper($content, false, true);
         } else {
             $rendered = $this->renderHelper($content, $form);
         }
         $content->setOption(FormRow::RENDERED, true);
         return $rendered;
     }
     return parent::render($content, $attribs, $element, $form);
 }