2amigos / yii2-selectize-widget

Selectize From Brian Reavis Yii2 Widget
Other
73 stars 41 forks source link

Remove the Bootstrap 3 dependency #42

Open ivan-cc opened 6 years ago

ivan-cc commented 6 years ago

I use Bootstrap 4 (throgh a component). After I start using your component, Bootstrap 3 connects and my styles get overriden.

It happens because your component uses dependency in src/SelectizeAsset.php 'yii\bootstrap\BootstrapAsset'

Is it possible to remove this dependency or make it optional?

PS: also it would be great to be able to disconnect/change (in src/SelectizeAsset.php) css-file 'css/selectize.bootstrap3.css'

chtidom commented 5 years ago

Hi,

I encountered the same problem and eventually came to a solution. You can extend the component and the assets file. Then call your own asset file in the registerClientScript() method of the component and override the original assets call doing:


public function init()
{
    parent::init();
    // resetting BootstrapAsset to not load own css and js files
    \Yii::$app->assetManager->bundles['yii\\bootstrap\\BootstrapAsset'] = [
        'css' => [],
        'js' => []
    ];
}