コード例 #1
0
 /** {@inheritDoc} */
 public function beforeSet()
 {
     $fieldName = $this->getProperty('field_name', null);
     $fieldValue = $this->getProperty('field_value', null);
     $this->setProperties($this->object->toArray());
     if (!is_null($fieldName) && !is_null($fieldValue)) {
         $this->setProperty($fieldName, $fieldValue);
     }
     return parent::beforeSet();
 }
コード例 #2
0
 /** {@inheritDoc} */
 public function initialize()
 {
     $data = $this->getProperty('data');
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     $data = $this->modx->fromJSON($data);
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     $this->setProperties($data);
     $this->unsetProperty('data');
     return parent::initialize();
 }