Issue #1968322 by effulgentsia: Remove unused $id and $zebra variables from templates.
parent
677a98f63b
commit
9f723a4693
|
@ -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();
|
||||
|
||||
|
|
|
@ -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'];
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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".
|
||||
|
|
|
@ -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".
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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".
|
||||
|
|
Loading…
Reference in New Issue