public function beforeSave() { $isStatic = intval($this->getProperty('static', 0)); if ($isStatic == 1) { $staticFile = $this->getProperty('static_file'); if (empty($staticFile)) { $this->addFieldError('static_file', $this->modx->lexicon('static_file_ns')); } } return parent::beforeSave(); }
/** * Fire pre-save logic * {@inheritDoc} * @return boolean */ public function beforeSave() { $template = $this->getProperty('template'); if (empty($template)) { $this->setProperty('template', array()); } $caption = $this->getProperty('caption', ''); if (empty($caption)) { $this->setProperty('caption', $this->getProperty('name')); } $this->setInputProperties(); $this->setOutputProperties(); $els = $this->getProperty('els', null); if ($els !== null) { $this->object->set('elements', $els); } $rank = $this->getProperty('rank', 0); $this->object->set('rank', $rank); return parent::beforeSave(); }