/**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         $name = Html::getInputName($this->model, $this->attribute);
         $value = null;
         if (is_array($this->model->{$this->attribute})) {
             $value = StringHelper::base64EncodeUrl(serialize((array) $this->model->{$this->attribute}));
         } else {
             if (is_string($this->model->{$this->attribute})) {
                 $value = $this->model->{$this->attribute};
             }
         }
         $this->options['id'] = Html::getInputId($this->model, $this->attribute);
         //$element = Html::activeHiddenInput($this->model, $this->attribute, $this->options);
         $element = Html::hiddenInput($name, $value, $this->options);
     } else {
         $element = Html::hiddenInput($this->name, $this->value, $this->options);
     }
     $this->registerPlugin();
     $this->clientOptions['componentSelectId'] = $this->componentSelectId;
     $this->clientOptions['componentSettingsId'] = Html::getInputId($this->model, $this->attribute);
     $this->clientOptions['id'] = $this->id;
     $this->clientOptions['backend'] = UrlHelper::construct('/cms/admin-universal-component-settings/index')->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString();
     return $this->render('element', ['widget' => $this, 'element' => $element]);
 }
 public function actionSave()
 {
     $rr = new RequestResponse();
     $classComponent = \Yii::$app->request->get('component');
     /**
      * @var $component \skeeks\cms\relatedProperties\PropertyType;
      */
     $component = new $classComponent();
     if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
         $component->load(\Yii::$app->request->post());
         $forSave = StringHelper::base64EncodeUrl(serialize($component->attributes));
         $rr->success = true;
         $rr->message;
         $rr->data = ['forSave' => $forSave];
         return $rr;
     }
 }
Exemple #3
0
 /**
  * @return string
  */
 public function getComponentSettingsString()
 {
     return \skeeks\cms\helpers\StringHelper::base64EncodeUrl(serialize((array) $this->component_settings));
 }