Answer the question
In order to leave comments, you need to log in
How to include BootstrapPluginAsset in a separate module?
Goodnight.
A third-party theme is installed on the site so that bootstrap does not interfere, I turned it off completely in config/web.php
'assetManager' => [
'bundles' => [
'yii\bootstrap\BootstrapPluginAsset' => [
'js'=>[]
],
'yii\bootstrap\BootstrapAsset' => [
'css' => [],
],
],
],
public function init()
{
parent::init();
Yii::configure($this, require __DIR__ . '/config/config.php');
}
return [
'id' => 'admin',
'name' => 'TestName',
'components' => [
'assetManager' => [
'class' => yii\web\AssetManager::className(),
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => '@bower/bootstrap/dist',
'css' => ['css/bootstrap.min.css']
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => '@bower/bootstrap/dist',
'js' => ['js/bootstrap.min.js']
]
]
]
]
];
Answer the question
In order to leave comments, you need to log in
Результата и не может быть в текущем варианте, по сути дела Вы подключаете AssetManager c бутсрапом как компонент текущего модуля, а используется AssetManager приложения. Для решения задачи Вы можете применить один из вариантов:
1. При инициализации модуля заменить AssetManager используемый View на необходимый Вам, например так:
$assetManager = new \yii\web\AssetManager([
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => '@bower/bootstrap/dist',
'css' => ['css/bootstrap.min.css']
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => '@bower/bootstrap/dist',
'js' => ['js/bootstrap.min.js']
]
]
]);
Yii::$app->view->setAssetManager($assetManager);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question