addCssClass() 공개 메소드

public addCssClass ( string $class, boolean $condition = true, string | boolean $throw = false ) : Icon
$class string
$condition boolean
$throw string | boolean
리턴 Icon
예제 #1
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);
 }
예제 #2
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);
 }