TbHtml::addCssStyle PHP Method

addCssStyle() public static method

Appends a CSS style string to the given options.
public static addCssStyle ( string $style, array &$htmlOptions ) : array
$style string the CSS style string.
$htmlOptions array the options.
return array the options.
    public static function addCssStyle($style, &$htmlOptions)
    {
        if (is_array($style)) {
            $style = implode('; ', $style);
        }
        $style = rtrim($style, ';');
        $htmlOptions['style'] = isset($htmlOptions['style']) ? rtrim($htmlOptions['style'], ';') . '; ' . $style : $style;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     Yii::import('bootstrap.behaviors.TbWidget');
     $this->attachBehavior('tbWidget', new TbWidget());
     if (!isset($this->assetPath)) {
         $this->assetPath = Yii::getPathOfAlias('lib.bootstrap-wysihtml5');
     }
     if (!$this->bindPlugin) {
         $this->htmlOptions['data-plugin'] = 'wysihtml5';
         $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
     }
     TbHtml::addCssStyle('width: ' . $this->width . 'px; height: ' . $this->height . 'px;', $this->htmlOptions);
 }
All Usage Examples Of TbHtml::addCssStyle
TbHtml