diff --git a/core/includes/module.inc b/core/includes/module.inc index cca2ef9..e751284 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -201,39 +201,6 @@ function system_list_reset() { } /** - * Find dependencies any level deep and fill in required by information too. - * - * @param $files - * The array of filesystem objects used to rebuild the cache. - * - * @return - * The same array with the new keys for each module: - * - requires: An array with the keys being the modules that this module - * requires. - * - required_by: An array with the keys being the modules that will not work - * without this module. - */ -function _module_build_dependencies($files) { - require_once DRUPAL_ROOT . '/core/includes/graph.inc'; - foreach ($files as $filename => $file) { - $graph[$file->name]['edges'] = array(); - if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) { - foreach ($file->info['dependencies'] as $dependency) { - $dependency_data = drupal_parse_dependency($dependency); - $graph[$file->name]['edges'][$dependency_data['name']] = $dependency_data; - } - } - } - drupal_depth_first_search($graph); - foreach ($graph as $module => $data) { - $files[$module]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); - $files[$module]->requires = isset($data['paths']) ? $data['paths'] : array(); - $files[$module]->sort = $data['weight']; - } - return $files; -} - -/** * Determine whether a given module exists. * * @param $module diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index aa2f98f..b97a36f 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -140,6 +140,14 @@ function system_themes_page() { $admin_theme_options[$theme->name] = $theme->info['name']; $theme->is_default = ($theme->name == $theme_default); + // Add notes to default and administration theme. + $theme->notes = array(); + $theme->classes = array(); + if ($theme->is_default) { + $theme->classes[] = 'theme-default'; + $theme->notes[] = t('default theme'); + } + // Identify theme screenshot. $theme->screenshot = NULL; // Create a list which includes the current theme and all its base themes. @@ -182,6 +190,16 @@ function system_themes_page() { 'attributes' => array('title' => t('Settings for !theme theme', array('!theme' => $theme->info['name']))), ); } + + // Check for module dependency. + $theme->compatible = TRUE; + foreach ($theme->requires as $requires => $module) { + if (!module_exists($requires)) { + $theme->compatible = FALSE; + $theme->notes[] = t('@module missing', array('@module' => drupal_ucfirst($module['name']))); + } + } + if (!empty($theme->status)) { if (!$theme->is_default) { $theme->operations[] = array( @@ -198,7 +216,7 @@ function system_themes_page() { ); } } - else { + elseif ($theme->compatible) { $theme->operations[] = array( 'title' => t('Enable'), 'href' => 'admin/appearance/enable', @@ -214,14 +232,6 @@ function system_themes_page() { } } - // Add notes to default and administration theme. - $theme->notes = array(); - $theme->classes = array(); - if ($theme->is_default) { - $theme->classes[] = 'theme-default'; - $theme->notes[] = t('default theme'); - } - // Sort enabled and disabled themes into their own groups. $theme_groups[$theme->status ? 'enabled' : 'disabled'][] = $theme; } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index f4261e1..6cbaccd 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2326,6 +2326,39 @@ function system_get_info($type, $name = NULL) { } /** + * Find dependencies any level deep and fill in required by information too. + * + * @param $files + * The array of filesystem objects used to rebuild the cache. + * + * @return + * The same array with the new keys for each module: + * - requires: An array with the keys being the modules that this module + * requires. + * - required_by: An array with the keys being the modules that will not work + * without this module. + */ +function _system_build_dependencies($files) { + require_once DRUPAL_ROOT . '/core/includes/graph.inc'; + foreach ($files as $filename => $file) { + $graph[$file->name]['edges'] = array(); + if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) { + foreach ($file->info['dependencies'] as $dependency) { + $dependency_data = drupal_parse_dependency($dependency); + $graph[$file->name]['edges'][$dependency_data['name']] = $dependency_data; + } + } + } + drupal_depth_first_search($graph); + foreach ($graph as $module => $data) { + $files[$module]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); + $files[$module]->requires = isset($data['paths']) ? $data['paths'] : array(); + $files[$module]->sort = $data['weight']; + } + return $files; +} + +/** * Helper function to scan and collect module .info data. * * @return @@ -2424,7 +2457,7 @@ function system_rebuild_module_data() { ksort($modules); system_get_files_database($modules, 'module'); system_update_files_database($modules, 'module'); - $modules = _module_build_dependencies($modules); + $modules = _system_build_dependencies($modules); $modules_cache = $modules; } return $modules_cache; @@ -2572,6 +2605,7 @@ function system_rebuild_theme_data() { ksort($themes); system_get_files_database($themes, 'theme'); system_update_files_database($themes, 'theme'); + $themes = _system_build_dependencies($themes); return $themes; } diff --git a/core/themes/bartik/bartik.info b/core/themes/bartik/bartik.info index aab37a7..7dfd538 100644 --- a/core/themes/bartik/bartik.info +++ b/core/themes/bartik/bartik.info @@ -5,6 +5,8 @@ package = Core version = VERSION core = 8.x +dependencies[] = system + stylesheets[all][] = css/layout.css stylesheets[all][] = css/style.css stylesheets[all][] = css/colors.css