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; }
/** * 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"> </label>'; $html .= '<div class="col-md-9">' . html('button', $element->getAttributes(), $element->getLabel()) . '</div>'; $html .= '</div>'; return $html; }
/** * Constructor * * @param $name * @param string $label * @param array $attr */ public function __construct($name, $attr = []) { parent::__construct($name, $name, $attr); $this->addAttribute('type', 'submit'); }
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; }