Exemple #1
0
 public function action(Element\Button $action)
 {
     if ($action->hasOption()) {
         $action->addClass(constant(Style::class . '::' . $action->getOption()));
     }
     if ($action->hasSize()) {
         $action->addClass(constant(Style::class . '::' . $action->getSize()));
     }
     $action->addClass(Style::BUTTON_CLASS);
     $label = '';
     if ($action->hasIcon()) {
         $label .= html('i', ['class' => $action->getIcon()]);
     }
     $name = $action->getLabel();
     if ($action->isIconOnly()) {
         $action->addClass('ff-tooltip-left');
     } else {
         $label .= $name;
     }
     if ($action->isRemote()) {
         $action->addAttribute('data-target', '#' . $action->getRemoteId())->addClass('modal-remote');
     } elseif ($action->isCallback()) {
         $action->addClass('callback-remote');
     }
     $action->addAttribute('title', $name);
     $html = html('a', $action->getAttributes(), $label);
     return $html;
 }
Exemple #2
0
 /**
  * rende a button element
  *
  * @param \FrenchFrogs\Form\Element\Button $element
  * @return string
  */
 public function button(Form\Element\Button $element)
 {
     //@todo prendre en compte les option et les size
     $element->addClass('btn btn-default');
     $element->addAttribute('id', $element->getName());
     $html = '<div class="form-group">';
     $html .= '<label class="col-md-3 control-label">&nbsp;</label>';
     $html .= '<div class="col-md-9">' . html('button', $element->getAttributes(), $element->getLabel()) . '</div>';
     $html .= '</div>';
     return $html;
 }
Exemple #3
0
 /**
  * Constructor
  *
  * @param $name
  * @param string $label
  * @param array $attr
  */
 public function __construct($name, $attr = [])
 {
     parent::__construct($name, $name, $attr);
     $this->addAttribute('type', 'submit');
 }
Exemple #4
0
 public function button(Form\Element\Button $element)
 {
     //@todo prendre en compte les option et les size
     $element->addClass('btn btn-default');
     $html = '<div class="form-group">';
     $html .= html('button', $element->getAttributes(), $element->getLabel());
     $html .= '</div>';
     return $html;
 }