public function init() { $this->name = \Yii::t('skeeks/form2/app', 'Control of property values'); $this->modelShowAttribute = "name"; $this->modelClassName = Form2FormProperty::className(); parent::init(); }
/** * * Все возможные свойства связанные с моделью * * @return array|\yii\db\ActiveRecord[] */ public function getRelatedProperties() { //return $this->form->form2FormProperties; return $this->hasMany(Form2FormProperty::className(), ['form_id' => 'id'])->via('form')->orderBy(['priority' => SORT_ASC]); }
/** * @return \yii\db\ActiveQuery */ public function getForm2FormProperties() { return $this->hasMany(Form2FormProperty::className(), ['form_id' => 'id'])->orderBy(['priority' => SORT_ASC]); }
<?php use yii\helpers\Html; use skeeks\cms\modules\admin\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model \yii\db\ActiveRecord */ $form = ActiveForm::begin(); ?> <? if ($form_id = \Yii::$app->request->get('property_id')) : ?> <?php echo $form->field($model, 'property_id')->hiddenInput(['value' => $form_id])->label(false); ?> <? else: ?> <?php echo $form->field($model, 'property_id')->widget(\skeeks\widget\chosen\Chosen::className(), ['items' => \yii\helpers\ArrayHelper::map(\skeeks\modules\cms\form2\models\Form2FormProperty::find()->all(), "id", "name")]); ?> <? endif; ?> <?php echo $form->field($model, 'value')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'code')->textInput(['maxlength' => 32]); ?> <?php echo $form->buttonsCreateOrUpdate($model); ?> <?php
/** * @return \yii\db\ActiveQuery */ public function getProperty() { return $this->hasOne(Form2FormProperty::className(), ['id' => 'property_id']); }