BcBaserHelper::getGlobalMenu PHP Method

getGlobalMenu() public method

グローバルメニューを取得する
public getGlobalMenu ( array $level = 1, array $options = [] ) : string
$level array 取得する階層(初期値 : 1)
$options array オプション(初期値 : array()) ※ その他のパラメータについては、View::element() を参照
return string
    public function getGlobalMenu($level = 1, $options = array())
    {
        $Content = ClassRegistry::init('Content');
        $siteId = 0;
        if (!empty($this->request->params['Content']['site_id'])) {
            $siteId = $this->request->params['Content']['site_id'];
        }
        $siteRoot = $Content->getSiteRoot($siteId);
        $id = $siteRoot['Content']['id'];
        $currentId = null;
        if (!empty($this->request->params['Content']['id'])) {
            $currentId = $this->request->params['Content']['id'];
        }
        $options = array_merge(['tree' => $this->BcContents->getTree($id, $level), 'currentId' => $currentId], $options);
        if (empty($_SESSION['Auth'][Configure::read('BcAuthPrefix.admin.sessionKey')])) {
            $options = array_merge($options, ['cache' => ['time' => Configure::read('BcCache.duration'), 'key' => $id]]);
        }
        return $this->getElement('global_menu', $options);
    }