button() public method

The type attribute defaults to type="submit" You can change it to a different value by using $options['type']. ### Options: - escape - HTML entity encode the $title of the button. Defaults to false.
public button ( string $title, array $options = [] ) : string
$title string The button's caption. Not automatically HTML encoded
$options array Array of options and HTML attributes.
return string A HTML button tag.
Beispiel #1
0
 /**
  * Creates a button.
  *
  * This method creates a button. To create a POST button, you should use
  *  the `postButton()` method.
  * Instead, to create a link with the appearance of a button, you should
  *  use the `button()` method provided by `HtmlHelper`.
  * @param string $title The button label or an image
  * @param array $options HTML attributes and options
  * @return string
  * @see postButton(), MeTools\View\Helper\HtmlHelper::button()
  */
 public function button($title, array $options = [])
 {
     $options = $this->optionsDefaults(['type' => 'button'], $options);
     if ($options['type'] === 'submit') {
         $options = $this->addButtonClasses($options, 'success');
     } else {
         $options = $this->addButtonClasses($options);
     }
     list($title, $options) = $this->addIconToText($title, $options);
     return parent::button($title, $options);
 }
 /**
  * 
  * Create & return a Twitter Like button.
  * 
  * ### New options:
  *
  * - bootstrap-type: Twitter bootstrap button type (primary, danger, info, etc.)
  * - bootstrap-size: Twitter bootstrap button size (mini, small, large)
  * 
  */
 public function button($title, array $options = [])
 {
     return parent::button($title, $this->_createButtonOptions($options));
 }
 public function button($title, array $options = array())
 {
     return parent::button($title, $this->_injectStyles($options, 'btn btn-success'));
 }
 public function button($title, array $options = array())
 {
     $options = $this->addClass($options, 'btn btn-default');
     return parent::button($title, $options);
 }
 /**
  * 
  * Create & return a Twitter Like button.
  * 
  * New options:
  * 	- bootstrap-type: Twitter bootstrap button type (primary, danger, info, etc.)
  * 	- bootstrap-size: Twitter bootstrap button size (mini, small, large)
  * 
  **/
 public function button($title, array $options = array())
 {
     $options = $this->_addButtonClasses($options);
     return parent::button($title, $options);
 }
Beispiel #6
0
 /**
  * Create form button.
  *
  * @param string $title
  * @param array $options
  * @return string
  */
 public function button($title, array $options = [])
 {
     //  Set buttons
     if (!empty($options['button'])) {
         $btnPrefix = $this->Html->getBtnPrefix();
         $button = [$btnPrefix];
         foreach ((array) $options['button'] as $btn) {
             if ($btn !== true) {
                 $button[] = $btnPrefix . '-' . $btn;
             }
         }
         unset($options['button']);
         $options = $this->addClass($options, implode(' ', $button));
     }
     //  Set icon
     if (isset($options['icon'])) {
         $_iconOptions = [];
         if (isset($options['iconClass'])) {
             $_iconOptions = $this->addClass($_iconOptions, $options['iconClass']);
             unset($options['iconClass']);
         }
         $options['escape'] = false;
         $title = $this->Html->icon($options['icon'], $_iconOptions) . PHP_EOL . $title;
         unset($options['icon']);
     }
     return parent::button($title, $options);
 }
 public function reset($title, array $options = array())
 {
     $options = $this->addClass($options, 'btn btn-link');
     return parent::button($title, $options);
 }