protected function beforeSave() { if (parent::beforeSave()) { if (empty($this->menuid)) { return false; } if (!isset($this->visible)) { $this->visible = true; } if (!isset($this->descriptionashint)) { $this->descriptionashint = true; } if (!isset($this->titles)) { $this->titles = $this->asa('attributesBehavior')->initLanguageAttribute('titles'); } if (empty($this->sortposition)) { $this->sortposition = 0; } if (!isset($this->adminroles)) { $this->adminroles = ''; } if (is_array($this->adminroles)) { $this->adminroles = implode(',', $this->adminroles); } return true; } else { return false; } }
protected function beforeSave() { if (parent::beforeSave()) { if (empty($this->itemid)) { $this->itemid = md5(uniqid()); } if (empty($this->url)) { $this->url = '#'; } if (!isset($this->active)) { $this->active = false; } if (!isset($this->visible)) { $this->visible = true; } if (!isset($this->descriptionashint)) { $this->descriptionashint = true; } if (!isset($this->labels)) { $this->labels = $this->asa('attributesBehavior')->initLanguageAttribute('labels'); } if (!isset($this->descriptions)) { $this->descriptions = $this->asa('attributesBehavior')->initLanguageAttribute('descriptions'); } return true; } else { return false; } }