Commit 8e57fb52 authored by Dries's avatar Dries

Issue #1938430 by shanethehat, steveoliver, Fabianx: Don't add a default theme...

Issue #1938430 by shanethehat, steveoliver, Fabianx: Don't add a default theme hook class in template_preprocess().
parent b3420405
......@@ -1646,6 +1646,10 @@ function template_preprocess_datetime(&$variables) {
$variables['html'] = FALSE;
}
}
// Add a 'datetime' class.
$variables['attributes']['class'][] = 'datetime';
$variables['attributes'] = new Attribute($variables['attributes']);
}
......@@ -2686,9 +2690,6 @@ function template_preprocess(&$variables, $hook) {
'title_attributes' => array(),
'content_attributes' => array(),
);
// Initialize html class attribute for the current hook.
$variables['attributes']['class'][] = drupal_html_class($hook);
}
/**
......@@ -2732,6 +2733,7 @@ function template_preprocess_html(&$variables) {
// Compile a list of classes that are going to be applied to the body element.
// This allows advanced theming based on context (home page, node of certain type, etc.).
$variables['attributes']['class'][] = 'html';
// Add a class that tells us whether we're on the front page or not.
$variables['attributes']['class'][] = $variables['is_front'] ? 'front' : 'not-front';
// Add a class that tells us whether the page is viewed by an authenticated user or not.
......@@ -3109,6 +3111,7 @@ function template_preprocess_maintenance_page(&$variables) {
$variables['title'] = drupal_get_title();
// Compile a list of classes that are going to be applied to the body element.
$variables['attributes']['class'][] = 'maintenance-page';
$variables['attributes']['class'][] = 'in-maintenance';
if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
$variables['attributes']['class'][] = 'db-offline';
......@@ -3169,6 +3172,7 @@ function template_preprocess_region(&$variables) {
$variables['content'] = $variables['elements']['#children'];
$variables['region'] = $variables['elements']['#region'];
$variables['attributes']['class'][] = 'region';
$variables['attributes']['class'][] = drupal_region_class($variables['region']);
$variables['theme_hook_suggestions'][] = 'region__' . $variables['region'];
}
......
......@@ -539,6 +539,7 @@ function template_preprocess_block(&$variables) {
$variables['label'] = !empty($variables['configuration']['label_display']) ? $variables['configuration']['label'] : '';
$variables['content'] = $variables['elements']['content'];
$variables['attributes']['class'][] = 'block';
$variables['attributes']['class'][] = drupal_html_class('block-' . $variables['configuration']['module']);
// Add default class for block content.
......
......@@ -1646,6 +1646,7 @@ function template_preprocess_comment(&$variables) {
}
// Gather comment classes.
$variables['attributes']['class'][] = 'comment';
// 'published' class is not needed, it is either 'preview' or 'unpublished'.
if ($variables['status'] != 'published') {
$variables['attributes']['class'][] = $variables['status'];
......@@ -1724,6 +1725,9 @@ function template_preprocess_comment_wrapper(&$variables) {
$variables['display_mode'] = variable_get('comment_default_mode_' . $variables['node']->type, COMMENT_MODE_THREADED);
// The comment form is optional and may not exist.
$variables['content'] += array('comment_form' => array());
// Add a comment wrapper class.
$variables['attributes']['class'][] = 'comment-wrapper';
}
/**
......
......@@ -82,6 +82,9 @@ public function renderLayout($admin = FALSE, $regions = array()) {
$build = array(
'#theme' => $definition['theme'],
'#content' => array(),
'#attributes' => array(
'class' => drupal_html_class($definition['theme']),
),
);
// Render all regions needed for this layout.
......
......@@ -1186,6 +1186,7 @@ function template_preprocess_node(&$variables) {
$variables['attributes']['role'] = 'article';
// Gather node classes.
$variables['attributes']['class'][] = 'node';
$variables['attributes']['class'][] = drupal_html_class('node-' . $node->type);
if ($node->promote) {
$variables['attributes']['class'][] = 'promoted';
......
......@@ -519,6 +519,10 @@ function template_preprocess_overlay(&$variables) {
$variables['tabs'] = menu_primary_local_tasks();
$variables['title'] = drupal_get_title();
$variables['disable_overlay'] = overlay_disable_message();
// Add atrributes for the overlay container.
$variables['attributes']['class'][] = 'overlay';
// Add attributes for the overlay content.
$variables['content_attributes']['class'][] = 'clearfix';
}
......
......@@ -490,6 +490,7 @@ function template_preprocess_taxonomy_term(&$variables) {
field_attach_preprocess($term, $variables['content'], $variables);
// Gather classes, and clean up name so there are no underscores.
$variables['attributes']['class'][] = 'taxonomy-term';
$vocabulary_name_css = str_replace('_', '-', $term->bundle());
$variables['attributes']['class'][] = 'vocabulary-' . $vocabulary_name_css;
......
......@@ -620,6 +620,7 @@ function template_preprocess_views_view_table(&$vars) {
}
$vars['attributes']['class'][] = 'views-table';
$vars['attributes']['class'][] = 'views-view-table';
if (empty($vars['rows']) && !empty($options['empty_table'])) {
$build = $view->display_handler->renderArea('empty');
$vars['rows'][0][0] = drupal_render($build);
......
......@@ -24,6 +24,8 @@ function template_preprocess_views_ui_display_tab_setting(&$variables) {
array_unshift($variables['settings_links'], $variables['link']);
$variables['settings_links'] = implode('<span class="label">&nbsp;|&nbsp;</span>', $variables['settings_links']);
$variables['attributes']['class'][] = 'views-ui-display-tab-setting';
if (!empty($variables['defaulted'])) {
$variables['attributes']['class'][] = 'defaulted';
}
......@@ -41,6 +43,8 @@ function template_preprocess_views_ui_display_tab_setting(&$variables) {
function template_preprocess_views_ui_display_tab_bucket(&$variables) {
$element = $variables['element'];
$variables['attributes']['class'][] = 'views-ui-display-tab-bucket';
if (!empty($element['#name'])) {
$variables['attributes']['class'][] = drupal_html_class($element['#name']);
}
......
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