예제 #1
0
 /**
  * @param Zend\Form\Element $element
  *
  * @return string
  */
 protected function getElement(Element $element)
 {
     $element->setLabelAttributes(array('class' => 'control-label col-sm-2'));
     $element->setAttribute('data-placement', 'bottom')->setAttribute('class', 'form-control')->setAttribute('data-content', $element->getOption('description'))->setAttribute('data-trigger', 'focus');
     if (!$element->getLabel()) {
         $element->setLabel('öö');
     }
     $output = sprintf('<div class="form-group%1$s">', $element->getMEssages() && !$element instanceof \Zend\Form\Element\Collection ? ' has-error' : '');
     $output .= $this->getView()->formLabel($element);
     $output .= '<div class="col-sm-10">';
     if ($element->getMessages() && !$element instanceof \Zend\Form\Element\Collection) {
         $output .= sprintf('<div class="input-group"><span data-toggle="tooltip" data-placement="bottom" class="input-group-addon" data-html="true" title="%1$s"><i class="fa-warning fa"></i></span>', $this->getView()->formElementErrors($element));
     }
     if ($element instanceof \Zend\Form\Element\Collection) {
         $output .= $this->getView()->formCollection($element);
     } else {
         $output .= $this->getView()->formElement($element);
     }
     if ($element->getMessages()) {
         $output .= '</div>';
     }
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }