/**
  * @param string|Icon $icon
  * @param string|null $label
  * @param array $options
  * @return static
  */
 public function item($icon, $label = null, $options = [])
 {
     if (is_string($icon)) {
         $icon = new Icon($icon);
     }
     $content = trim((string) $icon->li() . $label);
     $this->items[] = Html::tag('li', $content, $options);
     return $this;
 }
Example #2
0
 /**
  * @param string|null $tag
  * @param array $options
  * @return string
  * @throws \yii\base\InvalidConfigException
  */
 public function render($tag = null, $options = [])
 {
     $tag = empty($tag) ? empty($this->tag) ? static::$defaultTag : $this->tag : $tag;
     $options = array_merge($this->options, $options);
     $icon_back = $this->icon_back instanceof Icon ? $this->icon_back->addCssClass('fa-stack-2x') : null;
     $icon_front = $this->icon_front instanceof Icon ? $this->icon_front->addCssClass('fa-stack-1x') : null;
     return Html::tag($tag, $icon_back . $icon_front, $options);
 }
Example #3
0
 /**
  * @deprecated
  * @param string|null $tag
  * @param array $options
  * @return string
  * @throws \yii\base\InvalidConfigException
  */
 public function render($tag = null, $options = [])
 {
     $tag = empty($tag) ? empty($this->tag) ? static::$defaultTag : $this->tag : $tag;
     $options = array_merge($this->options, $options);
     $template = ArrayHelper::remove($options, 'template', '{back}{front}');
     $icon_back = $this->icon_back instanceof Icon ? $this->icon_back->addCssClass(FA::$cssPrefix . '-stack-2x') : null;
     $icon_front = $this->icon_front instanceof Icon ? $this->icon_front->addCssClass(FA::$cssPrefix . '-stack-1x') : null;
     return Html::tag($tag, str_replace(['{back}', '{front}'], [$icon_back, $icon_front], $template), $options);
 }