Inheritance: extends yii\base\Model, implements skeeks\cms\base\ConfigFormInterface
示例#1
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $find = CmsContentElement::find()->active();
     if ($this->content_id) {
         $find->andWhere(['content_id' => $this->content_id]);
     }
     if ($this->fieldElement == self::FIELD_ELEMENT_SELECT) {
         $field = $this->activeForm->fieldSelect($this->property->relatedPropertiesModel, $this->property->code, ArrayHelper::map($find->all(), 'id', 'name'), []);
     } else {
         if ($this->fieldElement == self::FIELD_ELEMENT_SELECT_MULTI) {
             $field = $this->activeForm->fieldSelectMulti($this->property->relatedPropertiesModel, $this->property->code, ArrayHelper::map($find->all(), 'id', 'name'), []);
         } else {
             if ($this->fieldElement == self::FIELD_ELEMENT_RADIO_LIST) {
                 $field = parent::renderForActiveForm();
                 $field->radioList(ArrayHelper::map($find->all(), 'id', 'name'));
             } else {
                 if ($this->fieldElement == self::FIELD_ELEMENT_CHECKBOX_LIST) {
                     $field = parent::renderForActiveForm();
                     $field->checkboxList(ArrayHelper::map($find->all(), 'id', 'name'));
                 }
             }
         }
     }
     if (!$field) {
         return '';
     }
     return $field;
 }
示例#2
0
 public function init()
 {
     parent::init();
     if (!$this->name) {
         $this->name = \Yii::t('app', 'Number');
     }
 }
示例#3
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $pluginOptions = ['showAlpha' => (bool) ($this->showAlpha === Cms::BOOL_Y), 'showInput' => (bool) ($this->showInput === Cms::BOOL_Y), 'showPalette' => (bool) ($this->showPalette === Cms::BOOL_Y)];
     $field->widget(ColorInput::className(), ['showDefaultPalette' => (bool) ($this->showDefaultPalette === Cms::BOOL_Y), 'useNative' => (bool) ($this->useNative === Cms::BOOL_Y), 'saveValueAs' => (string) $this->saveValueAs, 'pluginOptions' => $pluginOptions]);
     return $field;
 }
示例#4
0
 public function init()
 {
     parent::init();
     if (!$this->name) {
         $this->name = \Yii::t('skeeks/cms', 'File');
     }
 }
示例#5
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     if (in_array($this->fieldElement, array_keys(self::fieldElements()))) {
         $fieldElement = $this->fieldElement;
         $field->{$fieldElement}(['rows' => $this->rows]);
     } else {
         $field->textInput([]);
     }
     return $field;
 }
示例#6
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $find = CmsContentElement::find()->active();
     if ($this->content_id) {
         $find->andWhere(['content_id' => $this->content_id]);
     }
     if ($this->multiple == Cms::BOOL_N) {
         $field = $this->activeForm->fieldSelect($this->model->relatedPropertiesModel, $this->property->code, ArrayHelper::map($find->all(), 'id', 'name'), []);
     } else {
         if ($this->multiple == Cms::BOOL_Y) {
             $field = $this->activeForm->fieldSelectMulti($this->model->relatedPropertiesModel, $this->property->code, ArrayHelper::map($find->all(), 'id', 'name'), []);
         }
     }
     return $field;
 }
示例#7
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $field->widget(\skeeks\cms\widgets\formInputs\comboText\ComboTextInputWidget::className(), ['ckeditorOptions' => ['relatedModel' => $this->model]]);
     return $field;
 }
示例#8
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $field->widget(\skeeks\cms\widgets\formInputs\selectTree\SelectTree::className(), ["mode" => $this->isMultiple ? \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_MULTI : \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_SINGLE, "attributeSingle" => $this->property->code, "attributeMulti" => $this->property->code]);
     return $field;
 }
示例#9
0
 /**
  * @return $this
  */
 public function initInstance()
 {
     parent::initInstance();
     if (in_array($this->fieldElement, [self::FIELD_ELEMENT_SELECT_MULTI, self::FIELD_ELEMENT_CHECKBOX_LIST])) {
         $this->multiple = Cms::BOOL_Y;
     }
     return $this;
 }
示例#10
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $field->textInput();
     return $field;
 }
示例#11
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $field->widget(\kartik\datecontrol\DateControl::classname(), ['type' => $this->type]);
     return $field;
 }
示例#12
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $field->widget(\skeeks\cms\modules\admin\widgets\formInputs\OneImage::className(), ['filesModel' => $this->model]);
     return $field;
 }
示例#13
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     if ($this->fieldElement == self::FIELD_ELEMENT_SELECT) {
         $field = $this->activeForm->fieldSelect($this->property->relatedPropertiesModel, $this->property->code, ArrayHelper::map($this->property->enums, 'id', 'value'), []);
     } else {
         if ($this->fieldElement == self::FIELD_ELEMENT_SELECT_MULTI) {
             $field = $this->activeForm->fieldSelectMulti($this->property->relatedPropertiesModel, $this->property->code, ArrayHelper::map($this->property->enums, 'id', 'value'), []);
         } else {
             if ($this->fieldElement == self::FIELD_ELEMENT_RADIO_LIST) {
                 $field = parent::renderForActiveForm();
                 $field->radioList(ArrayHelper::map($this->property->enums, 'id', 'value'));
             } else {
                 if ($this->fieldElement == self::FIELD_ELEMENT_CHECKBOX_LIST) {
                     $field = parent::renderForActiveForm();
                     $field->checkboxList(ArrayHelper::map($this->property->enums, 'id', 'value'));
                 } else {
                     if ($this->fieldElement == self::FIELD_ELEMENT_LISTBOX_MULTI) {
                         $field = parent::renderForActiveForm();
                         $field->listBox(ArrayHelper::map($this->property->enums, 'id', 'value'), ['size' => 5, 'multiple' => 'multiple']);
                     } else {
                         if ($this->fieldElement == self::FIELD_ELEMENT_LISTBOX) {
                             $field = parent::renderForActiveForm();
                             $field->listBox(ArrayHelper::map($this->property->enums, 'id', 'value'), ['size' => 1]);
                         }
                     }
                 }
             }
         }
     }
     if (!$field) {
         return '';
     }
     return $field;
 }