public function init() { parent::init(); if ($this->slug == null) { throw new InvalidConfigException("slug不能为空"); } $this->currentAbsoluteUrl = \Yii::$app->getRequest()->getAbsoluteUrl(); $collection = Menu::findBySlug($this->slug); $createCallbacks = Hook::trigger(\hass\menu\Module::EVENT_MENU_LINK_CREATE)->parameters; $this->items = NestedSetsTree::generateTree($collection, function ($item) use($createCallbacks) { list($item['label'], $item["url"]) = call_user_func($createCallbacks[$item['module']], $item['name'], $item['original']); $item["options"] = Serializer::unserializeToArray($item["options"]); return $item; }, 'items'); }
public function afterFind() { parent::afterFind(); $this->blocks = Serializer::unserialize($this->blocks); }