Beispiel #1
0
 public static function getFieldTypes()
 {
     $array = [];
     foreach (FieldType::find()->all() as $item) {
         $array[$item['id']] = $item['name'];
     }
     return $array;
 }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFieldType()
 {
     return $this->hasOne(FieldType::className(), ['id' => 'type']);
 }
Beispiel #3
0
<div class="field-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'system_name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'type')->dropDownList(\backend\models\FieldType::getFieldTypes());
?>

    <?php 
echo $form->field($model, 'length')->textInput();
?>

    <?php 
echo $form->field($model, 'default')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'table_id')->dropDownList(\backend\models\Table::getTablesList());
?>

    <div class="form-group">