예제 #1
0
 public function __invoke(ElementInterface $element = null)
 {
     if ($element && !$element->hasAttribute('class')) {
         $this->addClasses($element, ['btn', 'btn-default']);
     }
     return parent::__invoke($element);
 }
예제 #2
0
 public function render(ElementInterface $element)
 {
     $element->setAttribute('class', $element->getAttribute('class') . " btn");
     $input = parent::render($element);
     $options = $element->getOptions();
     if (!empty($options['as-group'])) {
         $col_left_width = 'sm-6';
         $col_right_width = 'sm-6';
         $button_column = 'left';
         if (!empty($options['col-left-width'])) {
             $col_left_width = $options['col-left-width'];
         }
         if (!empty($options['col-right-width'])) {
             $col_right_width = $options['col-right-width'];
         }
         if (!empty($options['button-column'])) {
             $button_column = $options['button-column'];
         }
         $colFormat = '<div class="col-%s">%s</div><div class="col-%s">%s</div>';
         $buttonFormat = '<div class="btn-group btn-group-justified"><div class="btn-group">%s</div></div>';
         $inputContainer = sprintf($buttonFormat, $input);
         $leftColumn = $inputContainer;
         $rightColumn = '';
         if ($button_column != 'left') {
             $leftColumn = '';
             $rightColumn = $inputContainer;
         }
         $input = sprintf($colFormat, $col_left_width, $leftColumn, $col_right_width, $rightColumn);
     }
     return $input;
 }
예제 #3
0
 /**
  * Render a form <input> password 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())
 {
     $this->prepareElementBeforeRendering($element, $formType, $displayOptions);
     $html = parent::render($element);
     return $html;
 }
예제 #4
0
 /**
  * Submit
  *
  * @param ElementInterface|null $element
  * @return string|Helper\FormInput
  */
 public function submit(ElementInterface $element = null)
 {
     $helper = new Helper\FormSubmit();
     return $helper->__invoke($element);
 }