Answer the question
In order to leave comments, you need to log in
Yii2 how to use foreach to display multiple images in a widget?
The people of Google are already screaming from my requests) I
use the FileInput Widget / cool thing.
So I came to the conclusion that it is required to display a lot of already loaded previews.
<?= $form->field($model, 'image[]')->widget(FileInput::classname(), [
'options' => ['accept' => 'image/*', 'multiple' => true,],
'pluginOptions' => [
'initialPreview'=>[
// вот тут я хочу foreach перебрать все фотки Preview
//foreach($photos as $photo){
Html::img("/images/".$photo->name, ['class'=>'file-preview-image', 'alt'=>'The Moon', 'title'=>'The Moon']),
//}
],
],
])->label(false);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question