Ejemplo n.º 1
0
 /**
  * Render in HTML an element of type Checkobx
  * @param \Phalcon\Forms\ElementInterface $element
  * @return string
  */
 function _renderCheck($element)
 {
     $messages = $this->getMessagesFor($element->getName());
     $hasMessages = count($messages) > 0 ? TRUE : FALSE;
     $divError = $hasMessages ? 'has-error' : '';
     $html = "<div class=\"form-group {$divError}\">";
     $html .= "<div class=\"checkbox {$divError}\">";
     $html .= "<label for=\"{$element->getName()}\">{$this->render($element->getName())}";
     $html .= '<i class="input-helper"></i>';
     $html .= $element->getLabel() . '</label>';
     if ($hasMessages) {
         $html .= "<span class=\"help-block\">{$messages[0]}</span>";
     }
     $html .= '</div></div>';
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * Render in HTML an element of type Radio
  * @param \Phalcon\Forms\ElementInterface $element
  * @return string
  */
 function _renderRadio($element)
 {
     $messages = $this->getMessagesFor($element->getName());
     $hasMessages = count($messages) > 0 ? TRUE : FALSE;
     $divError = $hasMessages ? 'has-error' : "";
     $html = "<div class=\"form-group {$divError}\">";
     $html .= "<div class=\"radio {$divError}\">";
     $html .= "<label for=\"{$element->getName()}\">{$this->render($element->getName())} {$element->getLabel()}</label>";
     if ($hasMessages) {
         $html .= "<span class=\"help-block\">{$messages[0]}</span>";
     }
     $html .= '</div></div>';
     return $html;
 }