Example #1
0
 /**
  *
  * Add Button to $actions container
  *
  * @param $name
  * @param $label
  * @param string $href
  * @param array $attr
  * @return \FrenchFrogs\Panel\Action\Button
  */
 public function addButton($name, $label, $href = '#', $attr = [])
 {
     $e = new Action\Button($name, $label, $attr);
     $e->addAttribute('href', $href);
     $this->addAction($e);
     return $e;
 }
Example #2
0
 /**
  *
  *
  * @param \FrenchFrogs\Panel\Action\Button $action
  * @return string
  */
 public function button(Panel\Action\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;
 }