Answer the question
In order to leave comments, you need to log in
Class 'kartik\select2\Select2' not found?
Tell me why the error Class 'kartik\select2\Select2' not found
falls out the
code below:
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use vova07\imperavi\Widget;
/* @var $this yii\web\View */
/* @var $model common\models\Blog */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="blog-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'text')->widget(Widget::className(), [
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'formatting'=> ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5'],
'plugins' => [
'clips',
'fullscreen'
]
]
]);
?>
<?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status_id')->dropDownList(['off','on']) ?>
<?= $form->field($model, 'sort')->textInput() ?>
<?= $form->field($model, 'tags')->widget(Select2::classname(), [ // собственно ошибка
'data' => \yii\helpers\ArrayHelper::map(\common\models\Tag::find()->all(),'id','name'),
'language' => 'ru',
'options' => ['placeholder' => 'Выбрать таг...','multiple'=>true],
'pluginOptions' => [
'allowClear' => true
],
]);
?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
Answer the question
In order to leave comments, you need to log in
This is because of the repository inside this extension. delete .git
Delete this folder from git git rm --cached yii2-widget-select2
Re-commit and push to server
Hello.
Obviously, you transferred this file manager manually, which you can’t do, especially if you absolutely don’t understand how Yii2 works, and the framework as a whole.
In the \vendor\yiisoft\extensions.php folder
Most likely they forgot to add:
'kartik-v/yii2-krajee-base' =>
array (
'name' => 'kartik-v/yii2-krajee-base',
'version' => '9999999-dev',
'alias' =>
array (
'@kartik/base' => $vendorDir . '/kartik-v/yii2-krajee-base',
),
),
'kartik-v/yii2-widget-select2' =>
array (
'name' => 'kartik-v/yii2-widget-select2',
'version' => '9999999-dev',
'alias' =>
array (
'@kartik/select2' => $vendorDir . '/kartik-v/yii2-widget-select2',
),
),
'kartik-v/yii2-widget-alert' =>
array (
'name' => 'kartik-v/yii2-widget-alert',
'version' => '9999999-dev',
'alias' =>
array (
'@kartik/alert' => $vendorDir . '/kartik-v/yii2-widget-alert',
),
),
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question