macgyer\yii2materializecss\widgets\Button::init PHP Method

init() public method

Initializes the widget.
public init ( )
    public function init()
    {
        parent::init();
        $this->clientOptions = false;
        Html::addCssClass($this->options, ['widget' => 'btn']);
        switch ($this->type) {
            case self::TYPE_FLOATING:
            case self::TYPE_FLAT:
                Html::addCssClass($this->options, ['btn_type' => "btn-{$this->type}"]);
                break;
        }
        if ($this->large) {
            Html::addCssClass($this->options, ['btn_size' => 'btn-large']);
        }
        if ($this->disabled) {
            Html::addCssClass($this->options, ['btn_disabled' => 'disabled']);
        }
    }

Usage Example

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->tagName = 'button';
     $this->options['type'] = 'submit';
     parent::init();
 }