Quantcast
Viewing all articles
Browse latest Browse all 293522

Remove unused $id and $zebra variables from templates

Spin-off from #1649780: Remove first/last/odd/even classes in favor of CSS3 pseudo selectors. That issue has a lot of support from people in principle, but still needs to work through some details for tables. Meanwhile, for #1927608: Remove the tight coupling between Block Plugins and Block Entities and cacheability of blocks, we need to decouple the markup produced by a block from its rendering context (i.e., region and position).

So, here's a hopefully uncontroversial small patch to make incremental progress. It removes the positional variables ($id (which despite the name is only a position counter, not an id) and $zebra) provided to all templates and the block-specific ones ($block_id (also only a position counter) and $block_zebra) provided to block.tpl.php. Core does not use these variables anyway (none of the core templates print them, they're only mentioned in the template documentation, and even there, only for block, node, and taxonomy-term, even though the variables are provided to all templates), and per #1649780: Remove first/last/odd/even classes in favor of CSS3 pseudo selectors, D8 contrib shouldn't use these variables either, since CSS3 is the better way.

This patch doesn't change the behavior of theme_item_list(), theme_table(), and similar functions that work on arrays and output zebra classes. That remains a job for #1649780: Remove first/last/odd/even classes in favor of CSS3 pseudo selectors or another spin-off. This patch is only about removing position/zebra handling from templates that work on single objects and rely on the theme system to track position based on invocation order.

AttachmentSizeStatusTest resultOperations
remove-template-zebra.patch6.23 KBIdlePASSED: [[SimpleTest]]: [MySQL] 54,348 pass(es).View details | Re-test

Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>