_form_adress_edit.php
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model frontend\models\Option */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="option-form">
<?php $form = ActiveForm::begin(); ?>
<input type="hidden" name="Option[model]" value="<?=$modeldb?>"/>
<input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/>
<?php foreach($models as $id => $row) {
?>
<label for="Option[<?=$id?>][<?=$key?>]"><?php echo Yii::t('app', $row->name); ?></label>
<input type="hidden" name="Option[<?=$id?>][id]" value="<?=$id?>" />
<input type="hidden" name="Option[<?=$id?>][template]" value="<?=$row->template?>"/>
<input type="<?=$row->template?>" name="Option[<?=$id?>][value][<?=$row->name?>]" class="form-control required" required value="<?=$modellang[$id][0]->value?>"/>
<?php if($row->hasErrors()) { ?><div class="help-block"><?php echo $modellang[$id][0]->getFirstError('value');?></div> <?php } ?>
<?php
if($row->translate) {
foreach($row->getLangs() as $language_id => $lang) {
?>
<div class="form-group">
<div class="col-xs-1"><?=$lang['lang_code']?></div>
<div class="col-xs-11"><input type="<?=$row->template?>" name="Option[<?=$id?>][lang][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$id][$lang['language_id']]->value?>"/></div>
</div>
<?php
}
}
}?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>