Exemplo n.º 1
0
 public function render(ElementInterface $element)
 {
     if ($element->getOption('static')) {
         return $this->getView()->formElementStatic($element);
     }
     return parent::render($element);
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function render(ElementInterface $element)
 {
     $captcha = $element->getCaptcha();
     if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
         throw new Exception\DomainException(sprintf('%s requires that the element has a "captcha" attribute ' . 'implementing %s; none found', __METHOD__, CaptchaAdapter::class));
     }
     $helper = $captcha->getHelperName();
     $renderer = $this->getView();
     if (!method_exists($renderer, 'plugin')) {
         throw new Exception\DomainException(sprintf('%s requires that the renderer implements plugin(); it does not', __METHOD__));
     }
     $helper = $renderer->plugin($helper);
     if ($helper instanceof TranslatorAwareInterface) {
         $rollbackTextDomain = $helper->getTranslatorTextDomain();
         $helper->setTranslatorTextDomain($this->getTranslatorTextDomain());
     }
     $markup = parent::render($element);
     if ($helper instanceof TranslatorAwareInterface) {
         $helper->setTranslatorTextDomain($rollbackTextDomain);
     }
     return $markup;
 }
Exemplo n.º 3
0
 /**
  * Captcha element
  *
  * @param ElementInterface|null $element
  * @return string|Helper\FormCaptcha
  */
 public function captcha(ElementInterface $element = null)
 {
     $helper = new Helper\FormCaptcha();
     return $helper->__invoke($element);
 }