<?= $form->field($model, 'site')->radioList([
$array =Post::getSite() //тут должен быть массив
], [
'item' => function ($index, $label, $name, $checked, $value) {
$return = [];
foreach ($array as $ar) {
$return .= '<label class="modal-radio">';
$return .= '<input type="radio" name="' . $ar['name'] . '" value="' . $ar['value'] . '" tabindex="3">';
$return .= '<i></i>';
$return .= '<span>' . ucwords($ar['label']) . '</span>';
$return .= '</label><br/>';
}
return $return;
}
]
); ?>
<?php
$img = $image->getPostImg($model->id);
if(!empty($img->name)){
echo Html::img('https://site.ku/frontend/web/' . $img->name, $options = ['id' => 'blah', 'style' => ['width' => '180px']]);
}
?>
yii\web\HttpException:400 yii\web\BadRequestHttpException: Не удалось проверить переданные данные. in /var/www/alex/data/www/site.ku/vendor/yiisoft/yii2/web/Controller.php:166
Stack trace:
#0 /var/www/alex/data/www/site.ku/vendor/yiisoft/yii2/base/Controller.php(155): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))
#1 /var/www/alex/data/www/site.ku/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('update', Array)
#2 /var/www/alex/data/www/site.ku/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('post/update', Array)
#3 /var/www/alex/data/www/site.ku/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#4 /var/www/alex/data/www/site.ku/backend/web/index.php(17): yii\base\Application->run()
#5 {main}
<?php
$img = $image->getPostImg($model->id);
if(!empty($img->name)){
echo Html::img('https://site.ku/frontend/web/' . $img->name, $options = ['id' => 'blah', 'style' => ['width' => '180px']]);
}
?>
public static function getPostImg($post_id){
return self::find()->andWhere(['post_id' => $post_id, 'refer'=>'post' ])->one();
}