Enhancement documentation for $authorsAsArray
Closed this issue · 1 comments
adiramardiani commented
Hello, where $authorsAsArray source variable added/writted, or example script for that
beowulfenator commented
Hi!
This is standard Yii2 functionality, and I feel we shouldn't have it in our documentation.
This answer may help you:
http://stackoverflow.com/questions/21569053/how-to-make-a-drop-down-list-in-yii2
In our case it should be something like this:
<?= $form->field($model, 'author_list')
->dropDownList(ArrayHelper::map(Author::find()->all(), 'id', 'name')), ['multiple' => true]) ?>