Wildcards in body classes

Created on 8 August 2011, over 13 years ago
Updated 2 March 2023, almost 2 years ago

Since #422824: Add more specific body classes so page elements can be themed based on page type β†’ , we are using template suggestions to figure out body classes. Running theme_get_suggestions(array('node', '1'), 'page', '-') just as template_preprocess_html() does returns the following suggestions:

 Array(
    [0] => page-node
    [1] => page-node-%
    [2] => page-node-1
    [3] => page-front
) 

Now drupal_html_class() will turn page-node-% into 'page-node-', which is a meaningless class. Let's either strip the wildcard solutions before running drupal_html_class() or turn % into something meaningful.

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
MarkupΒ  β†’

Last updated about 2 months ago

No maintainer
Created by

πŸ‡§πŸ‡·Brazil barraponto

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom catch
    +++ b/core/includes/theme.inc
    @@ -1473,9 +1473,9 @@ function theme_get_suggestions($args, $base, $delimiter = '__') {
       //
       // page__node
    -  // page__node__%
       // page__node__1
       // page__node__edit
    +  // page__node__wildcard
     
    

    Isn't page__node identical to page__node__wildcard?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Guess it’s the same so should we remove page_node_%

    Should we be worried about BC

Production build 0.71.5 2024