From 9f723a46933159b41771f396b71c11156192c3c0 Mon Sep 17 00:00:00 2001 From: webchick Date: Mon, 15 Apr 2013 08:21:21 -0700 Subject: [PATCH] Issue #1968322 by effulgentsia: Remove unused $id and $zebra variables from templates. --- core/includes/theme.inc | 17 +++++------------ core/modules/block/block.module | 8 -------- core/modules/block/templates/block.tpl.php | 4 ---- core/modules/node/templates/node.html.twig | 3 --- core/modules/node/templates/node.tpl.php | 3 --- .../taxonomy/templates/taxonomy-term.tpl.php | 3 --- core/themes/bartik/templates/node.tpl.php | 3 --- 7 files changed, 5 insertions(+), 36 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 342c5bcfa5f..88ab65d72dc 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1147,11 +1147,11 @@ function theme($hook, $variables = array()) { // a function, but a template overrides that default implementation). In // these cases, a template should still be able to expect to have access to // the variables provided by template_preprocess(), so we add them here if - // they don't already exist. We don't want to run template_preprocess() - // twice (it would be inefficient and mess up zebra striping), so we use the - // 'directory' variable to determine if it has already run, which while not - // completely intuitive, is reasonably safe, and allows us to save on the - // overhead of adding some new variable to track that. + // they don't already exist. We don't want the overhead of running + // template_preprocess() twice, so we use the 'directory' variable to + // determine if it has already run, which while not completely intuitive, + // is reasonably safe, and allows us to save on the overhead of adding some + // new variable to track that. if (!isset($variables['directory'])) { $default_template_variables = array(); template_preprocess($default_template_variables, $hook); @@ -2615,13 +2615,6 @@ function template_preprocess(&$variables, $hook) { global $user; static $count = array(), $default_attributes; - // Track run count for each hook to provide zebra striping. See - // "template_preprocess_block()" which provides the same feature specific to - // blocks. - $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1; - $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even'; - $variables['id'] = $count[$hook]++; - // Tell all templates where they are located. $variables['directory'] = path_to_theme(); diff --git a/core/modules/block/block.module b/core/modules/block/block.module index d9d2106b124..afca3a92aec 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -539,14 +539,6 @@ function template_preprocess_block(&$variables) { $variables['block']->label = ''; } - // All blocks get an independent counter for each region. - if (!isset($block_counter[$variables['block']->region])) { - $block_counter[$variables['block']->region] = 1; - } - // Same with zebra striping. - $variables['block_zebra'] = ($block_counter[$variables['block']->region] % 2) ? 'odd' : 'even'; - $variables['block_id'] = $block_counter[$variables['block']->region]++; - // Create the $content variable that templates expect. $variables['content'] = $variables['elements']['#children']; diff --git a/core/modules/block/templates/block.tpl.php b/core/modules/block/templates/block.tpl.php index 00b554ae18a..4b301fab2b3 100644 --- a/core/modules/block/templates/block.tpl.php +++ b/core/modules/block/templates/block.tpl.php @@ -27,10 +27,6 @@ * the template. * * Helper variables: - * - $block_zebra: Outputs 'odd' and 'even' dependent on each block region. - * - $zebra: Same output as $block_zebra but independent of any block region. - * - $block_id: Counter dependent on each block region. - * - $id: Same output as $block_id but independent of any block region. * - $is_front: Flags true when presented in the front page. * - $logged_in: Flags true when the current user is a logged-in member. * - $is_admin: Flags true when the current user is an administrator. diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index f1e0b5aba62..0b3a32281bd 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -43,9 +43,6 @@ * - comment_count: Number of comments attached to the node. * - uid: User ID of the node author. * - created: Time the node was published formatted as a Unix timestamp. - * - zebra: Outputs either "even" or "odd". Useful for zebra striping in - * teaser listings. - * - id: Position of the node. Increments each time it's output. * * Node status variables: * - view_mode: View mode; for example, "teaser" or "full". diff --git a/core/modules/node/templates/node.tpl.php b/core/modules/node/templates/node.tpl.php index 196d26fbcaf..35cd730475b 100644 --- a/core/modules/node/templates/node.tpl.php +++ b/core/modules/node/templates/node.tpl.php @@ -46,9 +46,6 @@ * - $comment_count: Number of comments attached to the node. * - $uid: User ID of the node author. * - $created: Time the node was published formatted in Unix timestamp. - * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in - * teaser listings. - * - $id: Position of the node. Increments each time it's output. * * Node status variables: * - $view_mode: View mode; for example, "teaser" or "full". diff --git a/core/modules/taxonomy/templates/taxonomy-term.tpl.php b/core/modules/taxonomy/templates/taxonomy-term.tpl.php index 712e83c8836..0cd63d0e3e0 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.tpl.php +++ b/core/modules/taxonomy/templates/taxonomy-term.tpl.php @@ -23,9 +23,6 @@ * - $term: Full term object. Contains data that may not be safe. * - $view_mode: View mode, e.g. 'full', 'teaser'... * - $page: Flag for the full page state. - * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in - * teaser listings. - * - $id: Position of the term. Increments each time it's output. * - $is_front: Flags true when presented in the front page. * - $logged_in: Flags true when the current user is a logged-in member. * - $is_admin: Flags true when the current user is an administrator. diff --git a/core/themes/bartik/templates/node.tpl.php b/core/themes/bartik/templates/node.tpl.php index d32f9ace466..eb5cf17f770 100644 --- a/core/themes/bartik/templates/node.tpl.php +++ b/core/themes/bartik/templates/node.tpl.php @@ -46,9 +46,6 @@ * - $comment_count: Number of comments attached to the node. * - $uid: User ID of the node author. * - $created: Time the node was published formatted in Unix timestamp. - * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in - * teaser listings. - * - $id: Position of the node. Increments each time it's output. * * Node status variables: * - $view_mode: View mode; for example, "teaser" or "full".