상속: extends Cake\View\Helper\FormHelper, use trait OptionsAwareTrait
 /**
  * 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
 /**
  * Test that "form-control" class is added when using methods for specific input.
  *
  * @return void
  */
 public function testFormControlClassInjection()
 {
     $result = $this->Form->text('foo');
     $this->assertContains('class="form-control"', $result);
     $result = $this->Form->text('foo', ['class' => 'custom']);
     $this->assertContains('class="custom form-control"', $result);
     $result = $this->Form->select('foo');
     $this->assertContains('class="form-control"', $result);
     $result = $this->Form->textarea('foo');
     $this->assertContains('class="form-control"', $result);
     $result = $this->Form->dateTime('foo');
     $this->assertContains('class="form-control"', $result);
     $result = $this->Form->file('foo');
     $this->assertNotContains('"form-control"', $result);
     $result = $this->Form->checkbox('foo');
     $this->assertNotContains('"form-control"', $result);
     $result = $this->Form->radio('foo', ['1' => 'Opt 1', '2' => 'Opt 2']);
     $this->assertNotContains('"form-control"', $result);
 }
 /**
  * {@inheritDoc}
  */
 public function create($model = null, array $options = [])
 {
     $options['novalidate'] = true;
     return parent::create($model, $options);
 }