Answer the question
In order to leave comments, you need to log in
How to install jquery plugin in yii2?
There is a plugin for example selectBox or select2 in the composer packages, how can I install it in my yii application?
As I understand it, the first step is to enter it in composer.json
And then it will be installed in the vendor, how to connect it to the page?
Answer the question
In order to leave comments, you need to log in
Write the AssetBundle class, in which you specify all the plugin resources, and then simply call the register function in the places you need.
Everything is well written in the documentation about assets: https://github.com/yiisoft/yii2/blob/master/docs/g...
1) Download the bower package. The name (/font-awesome) can be found here https://bower.io/search/
2) Create a file in the \assets folder
namespace app\assets;
use yii\web\AssetBundle;
class FontAwesomeAsset extends AssetBundle
{
public $sourcePath = '@bower/font-awesome';
public $css = [
'css/all.min.css',
];
}
class AppAsset extends AssetBundle
{
...
public $depends = [
'app\assets\FontAwesomeAsset',
...
];
}
public $jsOptions = [
'position' => \yii\web\View::POS_HEAD,
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question