/**
  * Override modResourceUpdateProcessor::afterSave to provide custom functionality
  * {@inheritDoc}
  * @return boolean
  */
 public function afterSave()
 {
     $this->addContainerId();
     $this->removeFromArchivistIds();
     $this->setProperty('clearCache', true);
     $this->object->set('isfolder', true);
     return parent::afterSave();
 }
Ejemplo n.º 2
0
 /**
  * Override modResourceCreateProcessor::afterSave to provide custom functionality, saving the container settings to a
  * custom field in the manager
  * {@inheritDoc}
  * @return boolean
  */
 public function afterSave()
 {
     //$this->modx->log(1, __FILE__ . print_r($this->object->toArray(), true));
     $this->object->set('class_key', 'Taxonomy');
     $this->object->set('cacheable', true);
     $this->object->set('isfolder', true);
     return parent::afterSave();
 }
 /**
  * Override modResourceCreateProcessor::afterSave to provide custom functionality, saving the container settings to a
  * custom field in the manager
  * {@inheritDoc}
  * @return boolean
  */
 public function beforeSave()
 {
     $properties = $this->getProperties();
     $settings = $this->object->getProperties('articles');
     $notificationServices = array();
     foreach ($properties as $k => $v) {
         if (substr($k, 0, 8) == 'setting_') {
             $key = substr($k, 8);
             if ($v === 'false') {
                 $v = 0;
             }
             if ($v === 'true') {
                 $v = 1;
             }
             switch ($key) {
                 case 'notifyTwitter':
                     if ($v) {
                         $notificationServices[] = 'twitter';
                     }
                     break;
                 case 'notifyTwitterConsumerKey':
                     if (!empty($v)) {
                         $v = $this->object->encrypt($v);
                     }
                     break;
                 case 'notifyTwitterConsumerKeySecret':
                     if (!empty($v)) {
                         $v = $this->object->encrypt($v);
                     }
                     break;
                 case 'notifyFacebook':
                     if ($v) {
                         $notificationServices[] = 'facebook';
                     }
                     break;
             }
             $settings[$key] = $v;
         }
     }
     $settings['notificationServices'] = implode(',', $notificationServices);
     $this->object->setProperties($settings, 'articles');
     $this->object->set('class_key', 'ArticlesContainer');
     $this->object->set('cacheable', true);
     $this->object->set('isfolder', true);
     return parent::beforeSave();
 }