Change Widget CSS

I call widget in view page like this.


$this->widget('MyCustomWidget');

And it gives HTML rendered like this.




<div id="yw2" class="portlet">

<div class="portlet-content">

...what my custom widget does...

</div>

</div>

Those two DIVs are generated by widget function.

The problem are the already defined CSS classes.

I want to modify these classes specific by each widget.

Do anyone have suggestions how to do this?

Thanks in advance.

Check out the http://www.yiiframework.com/doc/api/CPortlet

You have:

contentCssClass http://www.yiiframework.com/doc/api/CPortlet#contentCssClass-detail

decorationCssClass http://www.yiiframework.com/doc/api/CPortlet#decorationCssClass-detail

titleCssClass http://www.yiiframework.com/doc/api/CPortlet#titleCssClass-detail

You will need to do:




$this->widget('MyCustomWidget', array('titleCssClass'=>'my-custom-class'));



Same for the other properties.

Great! Thanks.