_form.php
1.31 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
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\Catalog;
/* @var $this yii\web\View */
/* @var $model common\models\Catalog */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="catalog-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput() ?>
<?= $form->field($model, 'parent_id')->dropDownList(
ArrayHelper::map($model->find()->all(), 'parent_id', 'title')
)
?>
<?= $form->field($model, 'cover')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->dropDownList([
'1' => Yii::t('action', 'show'),
'0' => Yii::t('action', 'hide'),
]);
echo '<pre>';
$array = $model->findInfo([
'catalog_id' => 1,
'return_one' => true,
'to_array' => false,
]);
var_dump($array->relationCatalogLang2->title);
//var_dump($array->relationCatalogLang2->title);
echo '</pre>';
?>
<?= $form->field($model, 'sort')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('action', 'add') : Yii::t('action', 'update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>