/** * Resets any memory or cache involved with the active or edit theme. * @return void */ public static function resetCache() { self::$activeThemeCache = false; self::$editThemeCache = false; Cache::forget(self::ACTIVE_KEY); Cache::forget(self::EDIT_KEY); }
/** * Returns the edit theme. * By default the edit theme is loaded from the cms.editTheme parameter, * but this behavior can be overridden by the cms.editTheme event listeners. * If the edit theme is not defined in the configuration file, the active theme * is returned. * @return \Cms\Classes\Theme Returns the loaded theme object. * If the theme doesn't exist, returns null. */ public static function getEditTheme() { if (self::$editThemeCache !== false) { return self::$editThemeCache; } $editTheme = Config::get('cms.editTheme'); if (!$editTheme) { $editTheme = static::getActiveTheme()->getDirName(); } $apiResult = Event::fire('cms.editTheme', [], true); if ($apiResult !== null) { $editTheme = $apiResult; } if (!strlen($editTheme)) { throw new SystemException(Lang::get('cms::lang.theme.edit.not_set')); } $theme = new static(); $theme->load($editTheme); if (!File::isDirectory($theme->getPath())) { return self::$editThemeCache = null; } return self::$editThemeCache = $theme; }