2

我刚刚安装了vova07 / yii2-imperavi-widget并且,它可以php composer.phar require --prefer-dist 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']]
]);?>

实际上,我希望将数据提取到小部件中。

请帮我纠正这个问题。

4

1 回答 1

0

使用$modelEditPost->desc = $postDetails['desc']

$modelEditPost->desc = $postDetails['desc'];
  <?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
'settings' => ['lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>
于 2015-12-11T11:34:10.017 回答