public function beforeSave() { if (empty($this->title)) { $this->title = $this->Content ? $this->Content->title : 'No Title'; } if (empty($this->external_path) && $this->Content) { $this->Content->path = $this->createPath(); $this->Content->save(); } return parent::beforeSave(); }
public function beforeSave() { if (empty($this->path)) { $mainMenu = SnapUtil::config('general/site.default_menu'); $MI = MenuItem::model()->findByAttributes(array('menu_id' => $mainMenu, 'content_id' => $this->id)); if ($MI && !empty($this->id)) { $this->path = $MI->createPath(); } else { $this->path = '/' . $this->type . '/' . $this->title; } } $this->path = SnapFormat::slugify($this->path); return parent::beforeSave(); }