farhunt95
(Farhan Unijaya)
July 14, 2016, 4:05am
1
Hi, I am creating a Faq modules and I want to insert SummerNote package so that the form can look nicer
But error ‘SummerNote’ class not found came out
Below i have attatched my summernote directory package folder structure
I have check my composer.json and
"marqu3s/yii2-summernote": "dev-master" is already in there
I also check in vendor/yiisoft/extensions and
‘marqu3s/yii2-summernote’ =>
array (
'name' => 'marqu3s/yii2-summernote',
'version' => '9999999-dev',
'alias' =>
array (
'@marqu3s/summernote' => $vendorDir . '/marqu3s/yii2-summernote',
),
),
is already in there
below I attached my Faq controller and view page and the error that came out, I have tried many solution but nothing comes out, error Summernote class not found .
Bizley
(Bizley)
July 14, 2016, 5:49am
2
The proper namespace is marqu3s\summernote\Summernote
What editor are you using, is it Sublime? Maybe there is a way there to get namespaces hints like in any proper IDE.
farhunt95
(Farhan Unijaya)
July 14, 2016, 6:17am
3
Yes, I am using Sublime Text 3
I remove the below code from DefaultController and transfer it into form.php
"
use marqu3s\summernote\Summernote;
use marqu3s\summernote\SummernoteAsset;
use marqu3s\summernote\SummernoteLanguageAsset;
"
but other error come out, it says
Getting unknown property: backend\modules\faq\model\Faq::content
Any idea?, I think it is because of this line of code
"
<?= $form->field($model, ‘content’)->widget(Summernote::className(), [
'clientOptions' => [
'class'=>'',
]
]) ?>
"
Bizley
(Bizley)
July 14, 2016, 7:03am
4
SummernoteAsset and SummernoteLanguageAsset are asset classes that are registered by this widget so you don’t have to add use with them. As for the error you get it’s probably because you are using this widget on attribute ‘content’ that is not present in Faq model. Looks like you need some reading first, here are my recommendations:
PHP namespaces
Active Record
Creating Forms
Widgets
Assets