Issue #1968322 by effulgentsia: Remove unused $id and $zebra variables from templates.

8.0.x
webchick 2013-04-15 08:21:21 -07:00
parent 677a98f63b
commit 9f723a4693
7 changed files with 5 additions and 36 deletions

View File

@ -1147,11 +1147,11 @@ function theme($hook, $variables = array()) {
// a function, but a template overrides that default implementation). In // a function, but a template overrides that default implementation). In
// these cases, a template should still be able to expect to have access to // 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 // 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() // they don't already exist. We don't want the overhead of running
// twice (it would be inefficient and mess up zebra striping), so we use the // template_preprocess() twice, so we use the 'directory' variable to
// 'directory' variable to determine if it has already run, which while not // determine if it has already run, which while not completely intuitive,
// completely intuitive, is reasonably safe, and allows us to save on the // is reasonably safe, and allows us to save on the overhead of adding some
// overhead of adding some new variable to track that. // new variable to track that.
if (!isset($variables['directory'])) { if (!isset($variables['directory'])) {
$default_template_variables = array(); $default_template_variables = array();
template_preprocess($default_template_variables, $hook); template_preprocess($default_template_variables, $hook);
@ -2615,13 +2615,6 @@ function template_preprocess(&$variables, $hook) {
global $user; global $user;
static $count = array(), $default_attributes; 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. // Tell all templates where they are located.
$variables['directory'] = path_to_theme(); $variables['directory'] = path_to_theme();

View File

@ -539,14 +539,6 @@ function template_preprocess_block(&$variables) {
$variables['block']->label = ''; $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. // Create the $content variable that templates expect.
$variables['content'] = $variables['elements']['#children']; $variables['content'] = $variables['elements']['#children'];

View File

@ -27,10 +27,6 @@
* the template. * the template.
* *
* Helper variables: * 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. * - $is_front: Flags true when presented in the front page.
* - $logged_in: Flags true when the current user is a logged-in member. * - $logged_in: Flags true when the current user is a logged-in member.
* - $is_admin: Flags true when the current user is an administrator. * - $is_admin: Flags true when the current user is an administrator.

View File

@ -43,9 +43,6 @@
* - comment_count: Number of comments attached to the node. * - comment_count: Number of comments attached to the node.
* - uid: User ID of the node author. * - uid: User ID of the node author.
* - created: Time the node was published formatted as a Unix timestamp. * - 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: * Node status variables:
* - view_mode: View mode; for example, "teaser" or "full". * - view_mode: View mode; for example, "teaser" or "full".

View File

@ -46,9 +46,6 @@
* - $comment_count: Number of comments attached to the node. * - $comment_count: Number of comments attached to the node.
* - $uid: User ID of the node author. * - $uid: User ID of the node author.
* - $created: Time the node was published formatted in Unix timestamp. * - $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: * Node status variables:
* - $view_mode: View mode; for example, "teaser" or "full". * - $view_mode: View mode; for example, "teaser" or "full".

View File

@ -23,9 +23,6 @@
* - $term: Full term object. Contains data that may not be safe. * - $term: Full term object. Contains data that may not be safe.
* - $view_mode: View mode, e.g. 'full', 'teaser'... * - $view_mode: View mode, e.g. 'full', 'teaser'...
* - $page: Flag for the full page state. * - $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. * - $is_front: Flags true when presented in the front page.
* - $logged_in: Flags true when the current user is a logged-in member. * - $logged_in: Flags true when the current user is a logged-in member.
* - $is_admin: Flags true when the current user is an administrator. * - $is_admin: Flags true when the current user is an administrator.

View File

@ -46,9 +46,6 @@
* - $comment_count: Number of comments attached to the node. * - $comment_count: Number of comments attached to the node.
* - $uid: User ID of the node author. * - $uid: User ID of the node author.
* - $created: Time the node was published formatted in Unix timestamp. * - $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: * Node status variables:
* - $view_mode: View mode; for example, "teaser" or "full". * - $view_mode: View mode; for example, "teaser" or "full".