/** * Get all available themes that haven't been marked as disabled. * @param string $baseDir Optional alternative theme base directory for testing * @return array of theme directory names */ public function getAvailableThemesExtended($baseDir = null) { if (class_exists('Subsite') && Subsite::currentSubsiteID()) { $subsiteThemes = Subsite::config()->allowed_themes; // Make sure set theme is allowed $subsite = Subsite::currentSubsite(); if ($subsite->Theme && !in_array($subsite->Theme, $subsiteThemes)) { $subsiteThemes[] = $subsite->Theme; } // Make sure default theme is allowed $theme = Config::inst()->get('SSViewer', 'theme'); if ($theme && !in_array($theme, $subsiteThemes)) { $subsiteThemes[] = $theme; } return array_combine($subsiteThemes, $subsiteThemes); } $themes = SSViewer::get_themes($baseDir); $disabled = (array) $this->owner->config()->disabled_themes; foreach ($disabled as $theme) { if (isset($themes[$theme])) { unset($themes[$theme]); } } return $themes; }