Commit aaa4e9df authored by alexpott's avatar alexpott

Issue #2003814 by dasjo, pmelab, Cottser: Remove Bartik process layer...

Issue #2003814 by dasjo, pmelab, Cottser: Remove Bartik process layer functions, refactor color module alterations.
parent 4d08d574
......@@ -53,21 +53,18 @@ function color_form_system_theme_settings_alter(&$form, &$form_state) {
}
/**
* Replaces style sheets with color-altered style sheets.
*
* A theme that supports the color module should call this function from its
* THEME_process_html() function, so that the correct style sheets are
* included when html.tpl.php is rendered.
* Implements hook_css_alter().
*
* @see theme()
* Replaces style sheets with color-altered style sheets.
*/
function _color_html_alter(&$vars) {
function color_css_alter(&$css) {
global $theme_key;
$themes = list_themes();
// Override stylesheets.
$color_paths = config('color.' . $theme_key)->get('stylesheets');
if (!empty($color_paths)) {
if (!empty($color_paths) && !empty($themes[$theme_key]->stylesheets['all'])) {
foreach ($themes[$theme_key]->stylesheets['all'] as $base_filename => $old_path) {
// Loop over the path array with recolored CSS files to find matching
......@@ -78,25 +75,19 @@ function _color_html_alter(&$vars) {
if (drupal_basename($old_path) == drupal_basename($color_path)) {
// Replace the path to the new css file.
// This keeps the order of the stylesheets intact.
$vars['css'][drupal_basename($old_path)]['data'] = $color_path;
$css[drupal_basename($old_path)]['data'] = $color_path;
}
}
}
$vars['styles'] = drupal_get_css($vars['css']);
}
}
/**
* Replaces the logo with a color-altered logo.
*
* A theme that supports the color module should call this function from its
* THEME_process_page() function, so that the correct logo is included when
* page.tpl.php is rendered.
* Implements hook_preprocess_page().
*
* @see theme()
* Replace the logo with the colored version if available.
*/
function _color_page_alter(&$vars) {
function color_preprocess_page(&$vars) {
global $theme_key;
// Override logo.
......
......@@ -29,16 +29,6 @@ function bartik_preprocess_html(&$variables) {
}
}
/**
* Implements hook_process_HOOK() for html.tpl.php.
*/
function bartik_process_html(&$variables) {
// Hook into color.module.
if (module_exists('color')) {
_color_html_alter($variables);
}
}
/**
* Implements hook_preprocess_HOOK() for page.html.twig.
*/
......@@ -51,17 +41,8 @@ function bartik_preprocess_page(&$variables) {
if (!empty($variables['secondary_menu'])) {
$variables['secondary_menu']['#attributes']['id'] = 'secondary-menu-links';
}
}
/**
* Implements hook_process_HOOK() for page.html.twig.
*/
function bartik_process_page(&$variables) {
$site_config = config('system.site');
// Hook into color.module.
if (module_exists('color')) {
_color_page_alter($variables);
}
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
$variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE;
......@@ -103,12 +84,8 @@ function bartik_preprocess_maintenance_page(&$variables) {
$variables['site_name'] = '';
}
drupal_add_css(drupal_get_path('theme', 'bartik') . '/css/maintenance-page.css');
}
$variables['styles'] = drupal_get_css();
/**
* Implements hook_process_HOOK() for maintenance-page.html.twig.
*/
function bartik_process_maintenance_page(&$variables) {
$site_config = config('system.site');
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment