Exemplo n.º 1
0
 /**
  * Add action button
  *
  * @param $name
  * @param array $attr
  * @return \FrenchFrogs\Form\Element\Submit
  */
 public function addSubmit($name, $attr = [])
 {
     $e = new \FrenchFrogs\Form\Element\Submit($name, $attr);
     $e->setValue($name);
     $e->setOptionAsPrimary();
     $this->addAction($e);
     return $e;
 }
Exemplo n.º 2
0
 /**
  * Submit button render
  *
  * @param \FrenchFrogs\Form\Element\Submit $element
  * @return string
  */
 public function submit(Form\Element\Submit $element)
 {
     //OPTION
     if ($element->hasOption()) {
         $element->addClass(constant(Style::class . '::' . $element->getOption()));
     }
     //SIZE
     if ($element->hasSize()) {
         $element->addClass(constant(Style::class . '::' . $element->getSize()));
     }
     // CLASS
     $element->addClass(Style::BUTTON_CLASS);
     // LABEL
     $label = '';
     if ($element->hasIcon()) {
         $label .= html('i', ['class' => $element->getIcon()]);
     }
     $name = $element->getLabel();
     if ($element->isIconOnly()) {
         $element->addAttribute('data-toggle', 'tooltip');
     } else {
         $label .= $name;
     }
     // INPUT
     $element->addAttribute('type', 'submit');
     $element->addAttribute('value', $label);
     return html('input', $element->getAttributes());
 }