我刚刚通过php composer.phar require --prefer-dist vova07/yii2-imperavi-widget "*".
安装了 vova07 / yii2-imperavi-widget
并且,它可以很好地将任何内容插入到数据库表中。但是,在将数据提取到此小部件中时,我处于尴尬境地
我想要获取数据。所以,我创建了一个'value' => $postDetails['desc']
。 数据未来。
<?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
'settings' => [
'value' => $postDetails['desc'],
'lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>
但是,当我包括
时<?= $form->field($modelEditPost, 'desc')->textarea(['rows' => 6,'value'=>$postDetails['desc']]) ?>
(以前用来获取数据)以及小部件,数据来到小部件(但不是在textarea中))
<?= $form->field($modelEditPost, 'desc')->textarea(['rows' => 6,'value'=>$postDetails['desc']]) ?>
<?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
'settings' => [
'value' => $postDetails['desc'],
'lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>
实际上,我希望将数据提取到窗口小部件中。
请帮我纠正这个问题。
答案 0 :(得分:0)
使用$modelEditPost->desc = $postDetails['desc']
:
$modelEditPost->desc = $postDetails['desc'];
<?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
'settings' => ['lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>