/** * Renders the widget. */ public function run() { $this->registerPlugin('button'); $this->label = $this->getLabel(); if ($this->enableIcon) { $this->label .= Icon::widget(['label' => $this->icon, 'options' => $this->iconOptions]); } return Html::tag($this->tagName, $this->label, $this->options); }
/** * @param null $icon * @param array $options * @return $this */ public function icon($icon, $options = []) { if ($icon === false) { $this->parts['{icon}'] = ''; return $this; } $options = array_merge($this->iconOptions, $options); $this->parts['{icon}'] = Icon::widget(['name' => $icon, 'options' => $options]); return $this; }