Difference between #3 and #4 of
Override/Eliminate Bootstrap CSS/JS for Yii 2.0 widgets

Revision #4 has been created by Kartik V on Apr 14, 2014, 11:31:15 AM with the memo:

Yii object configuration change
« previous (#3) next (#5) »


Title unchanged

Override/Eliminate Bootstrap CSS/JS for Yii 2.0 widgets

Category unchanged


Yii version unchanged

Tags unchanged

yii 2, Widgets, bootstrap, style, customize, theme

Content changed

## Customizing Other Widgets
For other Yii widgets that are not part of an inbuilt Yii extension (like bootstrap or JUI), the widget itself does not have any CSS inbuilt. Rather the widget uses Bootstrap HTML markup as default which you can override.

An example of customizing the Yii GridView is mentioned here. You can easily override Bootstrap or other styling defaults by changing the GridView default options.

### Option 1:
EdiUpdating Oobject CDI config The simpler direct approach for you would be to override defaults for Yii's classes in your Yiiany place before using them. For global use - you can set this in your webroot index.php or in Yiithe config - something like:
\Yii::$objectConfig = [
// Set GridView defaults
'yii\grid\GridView' =>, [     'tableOptions' => [      'class' => 'table table-striped table-bordered',     ],     ],
// Set LinkPager defaults
'yii\widgets\LinkPager' =>, [      'options' => [     'class' => 'pagination',     ],
], ]);

### Option 2: Extend Yii Class
You can alternatively create custom classes extending Yii's inbuilt ones so you can use them across your app. For example:
4 2
Viewed: 56 053 times
Version: 2.0
Category: How-tos
Written by: Kartik V
Last updated by: CeBe
Created on: Feb 27, 2014
Last updated: 6 years ago
Update Article


View all history