示例#1
0
 /**
  * Render a form <input> text element from the provided $element,
  * @param  ElementInterface $element
  * @param  null|string $formType
  * @param  array $displayOptions
  * @return string
  */
 public function render(ElementInterface $element, $formType = null, array $displayOptions = array())
 {
     $formType = $this->formUtil->filterFormType($formType);
     $this->prepareElementBeforeRendering($element, $formType, $displayOptions);
     $html = parent::render($element);
     //Text prepend / append
     $escapeHelper = $this->getEscapeHtmlHelper();
     $escapeAttribHelper = $this->getEscapeHtmlAttrHelper();
     $prepAppClass = '';
     //Prepend icon (not possible on Search forms)
     if ($formType != FormUtil::FORM_TYPE_SEARCH && array_key_exists('prependIcon', $displayOptions)) {
         $prepAppClass = $this->genUtil->addWords('input-prepend', $prepAppClass);
         $html = sprintf('<span class="add-on"><i class="%s"></i></span>%s', $escapeAttribHelper($displayOptions['prependIcon']), $html);
     }
     //Prepend text
     if ($element->getOption('prependText')) {
         $prepAppClass = $this->genUtil->addWords('input-prepend', $prepAppClass);
         $html = '<span class="add-on">' . $escapeHelper($element->getOption('prependText')) . '</span>' . $html;
     }
     //Append icon (not possible on Search forms)
     if ($formType != FormUtil::FORM_TYPE_SEARCH && array_key_exists('appendIcon', $displayOptions)) {
         $prepAppClass = $this->genUtil->addWords('input-append', $prepAppClass);
         $html .= sprintf('<span class="add-on"><i class="%s"></i></span>', $escapeAttribHelper($displayOptions['appendIcon']));
     }
     //Append text
     if ($element->getOption('appendText')) {
         $prepAppClass = $this->genUtil->addWords('input-append', $prepAppClass);
         $html .= '<span class="add-on">' . $escapeHelper($element->getOption('appendText')) . '</span>';
     }
     if ($prepAppClass) {
         $html = '<div class="' . $prepAppClass . '">' . "\n{$html}\n" . '</div>';
     }
     return $html;
 }
示例#2
0
 public function render(ElementInterface $element)
 {
     if ($element->getOption('static')) {
         return $this->getView()->formElementStatic($element);
     }
     return parent::render($element);
 }
示例#3
0
 /**
  * Render 
  *
  * @param MultiCheckboxElement $element
  * @param array                $options
  * @param array                $selectedOptions
  * @param array                $attributes
  * @return string
  */
 public function render(FreeText $element)
 {
     $question = $element->getQuestion();
     $header = $element->getHeader();
     $content = "<dd><pre>" . $this->getView()->escapeHtml($question) . "</pre></dd>";
     $content .= "<dl>{$header}</dl>";
     $content .= parent::render($element);
     return $content;
 }
示例#4
0
 public function render(ElementInterface $element)
 {
     $result = '<div class="zui-field-group">';
     $result .= $this->getView()->formLabel($element);
     $result .= parent::render($element);
     $result .= $this->getView()->zourceFormDescription($element);
     $result .= $this->getView()->formElementErrors($element);
     $result .= '</div>';
     return $result;
 }
示例#5
0
 public function render(ElementInterface $element = null)
 {
     /* @var \Zend\View\Renderer\PhpRenderer $view */
     $view = $this->getView();
     /* @var \Zend\View\Helper\HeadScript $headScript */
     $headScript = $view->plugin('headscript');
     /* @var \Zend\View\Helper\BasePath $basePath */
     $basePath = $view->plugin('basePath');
     $params = $view->plugin('params');
     /* @var \Core\View\Helper\Params $params */
     $lang = $params('lang');
     $headScript->appendFile($basePath('/js/bootstrap-datepicker/js/bootstrap-datepicker.min.js'));
     if (in_array($this->language, ['de'])) {
         $headScript->appendFile($basePath('/js/bootstrap-datepicker/locales/bootstrap-datepicker.de.min.js'));
     }
     $element->setAttributes(['data-date-language' => $lang, 'data-provide' => 'datepicker', 'data-date-format' => 'yyyy-mm-dd']);
     $input = parent::render($element);
     /*
      *
      */
     $markup = '<div class="input-group date">%s<div data-toggle="description" data-target="%s" class="input-group-addon" onClick="$(this).parent().find(\':input\').datepicker(\'show\')">' . '<i class="fa fa-calendar"></i></div></div><div class="checkbox"></div>';
     $markup = sprintf($markup, $input, $element->getAttribute('id'));
     return $markup;
 }
 public function render(ElementInterface $oElement)
 {
     $id = $oElement->getAttribute('id');
     return sprintf(self::$outputFormat, $id . '-container', parent::render($oElement));
 }
 /**
  * Text
  *
  * @param ElementInterface|null $element
  * @return string|Helper\FormInput
  */
 public function text(ElementInterface $element = null)
 {
     $helper = new Helper\FormText();
     return $helper->__invoke($element);
 }