/**
  * Creates a `<button>` tag.
  *
  * 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.
  *
  * @param string $title The button's caption. Not automatically HTML encoded
  * @param array $options Array of options and HTML attributes.
  * @return string A HTML button tag.
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::button
  */
 public function button($title, array $options = array())
 {
     if (isset($options['icon'])) {
         $title = $this->Html->icon($options['icon']) . ' ' . $title;
         unset($options['icon']);
         $options['escape'] = false;
     }
     return parent::button($title, $options);
 }
예제 #2
0
 public function testPrimaryStyledButton()
 {
     $result = $this->Form->button('Submit', ['class' => 'primary']);
     $expected = ['button' => ['class' => 'btn-primary btn', 'type' => 'submit'], 'Submit', '/button'];
     $this->assertHtml($expected, $result);
 }