Example #1
0
 /**
  * @return array
  */
 public function getFormConfig()
 {
     return ['label' => ['type' => ActiveFormBuilder::INPUT_TEXT, 'options' => ['maxlength' => true, 'class' => 's_name']], 'alias' => ['type' => ActiveFormBuilder::INPUT_TEXT, 'options' => ['maxlength' => true, 'class' => 's_alias']], 'category_id' => ['type' => ActiveFormBuilder::INPUT_DROPDOWN_LIST, 'items' => \common\models\ArticleCategory::getItems(), 'options' => ['prompt' => '']], 'announce' => ['type' => ActiveFormBuilder::INPUT_WIDGET, 'widgetClass' => \backend\components\ImperaviContent::className(), 'options' => ['model' => $this, 'attribute' => 'announce']], 'content' => ['type' => ActiveFormBuilder::INPUT_WIDGET, 'widgetClass' => \backend\components\ImperaviContent::className(), 'options' => ['model' => $this, 'attribute' => 'content']], 'date' => ['type' => ActiveFormBuilder::INPUT_WIDGET, 'widgetClass' => \metalguardian\dateTimePicker\Widget::className(), 'options' => ['mode' => \metalguardian\dateTimePicker\Widget::MODE_DATE, 'options' => ['class' => 'form-control']]], 'titleImage' => ['type' => ActiveFormBuilder::INPUT_RAW, 'value' => ImageUpload::widget(['model' => $this, 'attribute' => 'titleImage', 'saveAttribute' => EntityToFile::TYPE_ARTICLE_TITLE_IMAGE, 'multiple' => false, 'aspectRatio' => 848 / 350, 'uploadUrl' => ImagesUploadModel::uploadUrl(['model_name' => static::className(), 'attribute' => 'titleImage', 'entity_attribute' => EntityToFile::TYPE_ARTICLE_TITLE_IMAGE])])], 'tags' => ['type' => ActiveFormBuilder::INPUT_TEXT, 'options' => ['maxlength' => true]], 'views' => ['type' => ActiveFormBuilder::INPUT_TEXT], 'published' => ['type' => ActiveFormBuilder::INPUT_CHECKBOX], 'position' => ['type' => ActiveFormBuilder::INPUT_TEXT], 'sign' => ['type' => ActiveFormBuilder::INPUT_RAW, 'value' => Html::activeHiddenInput($this, 'sign')]];
 }
Example #2
0
 /**
  * @return array
  */
 public function getValueFieldConfig()
 {
     $description = $this->description ? $this->description : null;
     switch ($this->type) {
         case static::TYPE_STRING:
             return ['type' => ActiveFormBuilder::INPUT_TEXT, 'hint' => $description];
             break;
         case static::TYPE_TEXT:
             return ['type' => ActiveFormBuilder::INPUT_TEXTAREA, 'hint' => $description];
             break;
         case static::TYPE_HTML:
             return ['type' => ActiveFormBuilder::INPUT_WIDGET, 'widgetClass' => ImperaviContent::className(), 'hint' => $description];
             break;
         case static::TYPE_INTEGER:
             return ['type' => ActiveFormBuilder::INPUT_TEXT, 'hint' => $description];
             break;
         case static::TYPE_DOUBLE:
             return ['type' => ActiveFormBuilder::INPUT_TEXT, 'hint' => $description];
             break;
         case static::TYPE_BOOLEAN:
             return ['type' => ActiveFormBuilder::INPUT_CHECKBOX, 'hint' => $description];
             break;
         case static::TYPE_FILE:
             return ['type' => ActiveFormBuilder::INPUT_FILE];
             break;
     }
     return ['type' => ActiveFormBuilder::INPUT_TEXT];
 }