Collective\Html\FormBuilder::button PHP Method

button() public method

Create a button element.
public button ( string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$value string
$options array
return Illuminate\Support\HtmlString
    public function button($value = null, $options = [])
    {
        if (!array_key_exists('type', $options)) {
            $options['type'] = 'button';
        }
        return $this->toHtmlString('<button' . $this->html->attributes($options) . '>' . $value . '</button>');
    }

Usage Example

 /**
  * Create a Boostrap submit button.
  *
  * @param  string $value
  * @param  array  $options
  *
  * @return string
  */
 public function button($value = null, array $options = [])
 {
     $options = array_merge(['class' => 'btn btn-primary'], $options);
     $inputElement = $this->form->button($value, $options);
     $wrapperOptions = $this->isHorizontal() ? ['class' => implode(' ', [$this->getLeftColumnOffsetClass(), $this->getRightColumnClass()])] : [];
     $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . '</div>';
     return $this->getFormGroup(null, $wrapperElement);
 }
All Usage Examples Of Collective\Html\FormBuilder::button