diff --git a/core/includes/theme.inc b/core/includes/theme.inc index ae6d1be..e84c095 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -716,15 +716,12 @@ function list_themes($refresh = FALSE) { * An array of available themes. * @param $key * The name of the theme whose base we are looking for. - * @param $used_keys - * (optional) A recursion parameter preventing endless loops. Defaults to - * NULL. * * @return * Returns an array of all of the theme's ancestors; the first element's value * will be NULL if an error occurred. */ -function drupal_find_base_themes($themes, $key, $used_keys = array()) { +function drupal_find_base_themes($themes, $key) { return \Drupal::service('theme_handler')->getBaseThemes($themes, $key); } diff --git a/core/lib/Drupal/Core/Theme/ThemeHandler.php b/core/lib/Drupal/Core/Theme/ThemeHandler.php index e8f6249..8adea15 100644 --- a/core/lib/Drupal/Core/Theme/ThemeHandler.php +++ b/core/lib/Drupal/Core/Theme/ThemeHandler.php @@ -18,10 +18,15 @@ use Drupal\Core\Extension\InfoParserInterface; /** - * Manages the list of available themes as well as enable/disable them. + * Default theme handler using the config system for enabled/disabled themes. */ class ThemeHandler implements ThemeHandlerInterface { + /** + * Contains the features enabled for themes by default. + * + * @var array + */ protected $defaultFeatures = array( 'logo', 'favicon', @@ -90,7 +95,9 @@ class ThemeHandler implements ThemeHandlerInterface { * @param \Drupal\Core\Extension\InfoParserInterface $info_parser * The info parser to parse the theme.info.yml files. * @param \Drupal\Core\Routing\RouteBuilder $route_builder - * The route builder to rebuild the routes if a theme is enabled. + * (optional) The route builder to rebuild the routes if a theme is enabled. + * @param \Drupal\Core\SystemListingInfo $system_list_info + * (optional) The system listing info. */ public function __construct(ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, InfoParserInterface $info_parser, RouteBuilder $route_builder = NULL, SystemListingInfo $system_list_info = NULL) { $this->configFactory = $config_factory; @@ -350,18 +357,18 @@ public function rebuildThemeData() { * e.g., to prefix all values of the 'stylesheets' or 'scripts' properties with * the file path to the defining module/theme. * - * @param $info + * @param array $info * A nested array of data of an .info.yml file to be processed. - * @param $path + * @param string $path * A file path to prepend to each value in $info. * - * @return + * @return array * The $info array with prefixed values. * * @see _system_rebuild_module_data() - * @see _system_rebuild_theme_data() + * @see self::rebuildThemeData() */ - protected function themeInfoPrefixPath($info, $path) { + protected function themeInfoPrefixPath(array $info, $path) { foreach ($info as $key => $value) { // Recurse into nested values until we reach the deepest level. if (is_array($value)) { @@ -430,6 +437,9 @@ protected function configInstallDefaultConfig($theme) { config_install_default_config('theme', $theme); } + /** + * Resets some other systems like rebuilding the route information or caches. + */ protected function resetSystem() { if ($this->routeBuilder) { $this->routeBuilder->rebuild(); @@ -442,18 +452,32 @@ protected function resetSystem() { $this->themeRegistryRebuild(); } + /** + * Wraps system_list_reset(). + */ protected function systemListReset() { system_list_reset(); } + /** + * Wraps drupal_clear_css_cache(). + */ protected function clearCssCache() { drupal_clear_css_cache(); } + /** + * Wraps drupal_theme_rebuild(). + */ protected function themeRegistryRebuild() { drupal_theme_rebuild(); } + /** + * Wraps system_list(). + * + * @return array + */ protected function systemThemeList() { return system_list('theme'); } diff --git a/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php b/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php index 5314f96..fb7c850 100644 --- a/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php +++ b/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php @@ -18,7 +18,8 @@ * @param array $theme_list * An array of theme names. * - * @throws ExtensionNameLengthException + * @throws \Drupal\Core\Extension\ExtensionNameLengthException + * Thrown when the theme name is to long */ public function enable(array $theme_list); @@ -33,8 +34,8 @@ public function disable(array $theme_list); /** * Returns a list of all currently available themes. * - * Retrieved from the database, if available and the site is not in maintenance - * mode; otherwise compiled freshly from the filesystem. + * Retrieved from the database, if available and the site is not in + * maintenance mode; otherwise compiled freshly from the filesystem. * * @return array * An associative array of the currently available themes. The keys are the @@ -50,8 +51,8 @@ public function disable(array $theme_list); * themes/bartik/style.css). Not set if no stylesheets are defined in the * .info.yml file. * - scripts: An associative array of JavaScripts, using the filename as key - * and the complete filepath as value. Not set if no scripts are defined in - * the .info.yml file. + * and the complete filepath as value. Not set if no scripts are defined + * in the .info.yml file. * - prefix: The base theme engine prefix. * - engine: The machine name of the theme engine. * - base_theme: If this is a sub-theme, the machine name of the base theme