This patch passes the body classes array through to the theme so that themers can add (or remove) classes to the body element.

Comments

keith.smith’s picture

Version: 6.x-dev » 7.x-dev

This is a feature request, so bumping to 7.x

mcjim’s picture

StatusFileSize
new594 bytes

Updated patch to work with latest version of HEAD.
I'm fairly new to these things, but as $body_classes is fairly easy to manipulate, though, should we be adding another variable to the mix?

robin monks’s picture

StatusFileSize
new595 bytes

Keeping in sync with head.

Status: Needs review » Needs work

The last submitted patch failed testing.

mcjim’s picture

Status: Needs work » Needs review
StatusFileSize
new596 bytes

Chasing head.

Status: Needs review » Needs work

The last submitted patch failed testing.

lilou’s picture

Status: Needs work » Needs review
mr.baileys’s picture

I agree with McJim (#2), should we really add body_classes_array when we already have body_classes?

The way I see it:

  • The body_classes-string is relatively easy to manipulate should themers really want to do this, either through regexes or explode/split/implode. Something like
    $body_classes_array = explode(" ", $body_classes);
    // do all kinds of nifty stuff with the classes array
    $body_classes = implode(" ", $body_classes_array);
    

    in the theme layer should do the trick, no?

  • Passing classes to the theme layer for other themeable elements seems to follow the pattern of passing them as one string, not an array
  • I couldn't immediately think of a use case for this. If theme layer is meant for presentation, why would it add or remove body classes?

@jjeff (or someone else): can you elaborate a bit on how this could be used?

mr.baileys’s picture

Issue tags: +Quick fix

Marking this quick fix since the change is trivial and unlikely to break anything.

cburschka’s picture

Status: Needs review » Reviewed & tested by the community

The code style is fine and this will break nothing, and I'm the second reviewer, so I am tentatively marking it RTBC.

However, we haven't solved the question of whether this is a useful feature.

webchick’s picture

Status: Reviewed & tested by the community » Needs review

That means it's not quite RTBC yet. Maybe ping some folks in #drupal-design or #drupal-themes tomorrow.

dvessel’s picture

johnalbin’s picture

Status: Needs review » Closed (duplicate)

Yep.