<?= $form->field($model, 'id')->label('')->dropDownList(ArrayHelper::map(Platforms::find()->all(), 'id', 'name'), ['id'=>'platform_id', 'prompt' => '- ' . Yii::t('main', 'Select platform') . ' -']) ?>
<?= $form->field($model, 'game_id')->label('')->widget(DepDrop::classname(), [
'type' => DepDrop::TYPE_SELECT2,
'options' => ['multiple' => true],
'disabled' =>false,
'pluginOptions'=>[
'depends'=>['platform_id'],
'placeholder'=>'- ' . Yii::t('main', 'Select games') . ' -',
'url'=>Url::to(['/user/default/getgame'])
]
])
?>
if (isset($model->game_id) ){
$gameValue = ArrayHelper::map(Game::find()->where(['id' => $model->game_id])->all(), 'id', 'name');
}else{
$gameValue = [];
<?= $form->field($model, 'game_id')->label('')->widget(DepDrop::classname(), [
'data' =>$ gameValue,
'type' => DepDrop::TYPE_SELECT2,
'options' => ['multiple' => true],
'disabled' =>false,
'pluginOptions'=>[
'depends'=>['platform_id'],
'placeholder'=>'- ' . Yii::t('main', 'Select games') . ' -',
'url'=>Url::to(['/user/default/getgame'])
]
])
?>