/** * Load profile by name * @param string $file * @return boolean */ public function load($name) { /* Load profile under profiles root dir */ /* Load from profiles directory of assets namespace */ $profileFile = Zo2Factory::getPath('assets://profiles/' . $name . '.json'); /* If asked file is not exists than load default */ if ($profileFile == false) { $profileFile = Zo2Factory::getPath('assets://profiles/' . self::DEFAULT_PROFILE_NAME . '.json'); } /* Profile file is existed */ if ($profileFile) { Zo2Factory::addLog('Loading profile', $profileFile); /* Load profile data by use json file */ $this->loadFile($profileFile); // Layout $layout = $this->get('layout'); if (is_string($layout)) { $layout = json_decode($layout); $this->set('layout', $layout); } // Menu config $menu_config = $this->get('menu_config'); if (is_string($menu_config)) { $menu_config = json_decode($menu_config); $this->set('menu_config', $menu_config); } // Theme $theme = $this->get('theme'); if (is_string($theme)) { $theme = json_decode($theme); $this->set('theme', $theme); } $this->_profileFile = $profileFile; return $this->isValid(); } return false; }