/** * {@inheritDoc} * @return mixed */ public function process() { if (!$this->object) { $this->element->setProperties($this->getData()); $this->element->save(); } else { /* Run the beforeSave method and allow stoppage */ $canSave = $this->beforeSave(); if ($canSave !== true) { return $this->failure($canSave); } $this->object->setProperties($this->getProperty('data')); if ($this->saveObject() == false) { return $this->failure($this->modx->lexicon($this->objectType . '_err_save')); } } $this->logManagerAction(); return $this->success(); }
/** * Convert JSON data to array and unset default properties * @return bool */ public function beforeSave() { $this->object->setProperties($this->getData()); return parent::beforeSave(); }