Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $content = '';
     if ($this->iconName !== null) {
         $this->iconConfig['name'] = $this->iconName;
         $content .= Icon::widget($this->iconConfig);
     }
     $content .= $this->encodeLabel ? Html::encode($this->label) : $this->label;
     return Html::tag($this->tagName, $content, $this->options);
 }
Exemplo n.º 3
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if ($this->route === null && Yii::$app->controller !== null) {
         $this->route = Yii::$app->controller->getRoute();
     }
     if ($this->params === null) {
         $this->params = Yii::$app->request->getQueryParams();
     }
     if ($this->dropDownCaret === null) {
         $this->dropDownCaret = Icon::widget(['name' => 'navigation-arrow-drop-down', 'options' => ['class' => 'right']]);
     }
 }