that way, if you set class to something, the individual checkboxes could be styled with

div.classname input

and the container itself could be styled with

div.classname

(and any of the other elements between them could be styled as well)

With the attributes getting passed down all the way to the checkboxes, there's no way to add a css class hook to the top level element.

CommentFileSizeAuthor
#7 checkboxes_class_1.patch939 bytesedmund.kwok
#3 checkboxes_class.patch774 byteschx

Comments

drumm’s picture

+1

magico’s picture

Any news about this?

chx’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new774 bytes

Whether this goes in this release or the next is not to be determined by me. Feel free to mark postponed. But, I kept the form-checkboxes class always, I am just adding another class -- if there is one.

drumm’s picture

+  if (isset($element['#attributes']['class'])) {
+    $class .= ' '. $element['#attributes']['#class'];

Is it 'class' or '#class'?

drumm’s picture

Status: Reviewed & tested by the community » Needs work
coreb’s picture

Version: x.y.z » 5.x-dev

Moving out of the "x.y.z" queue to a real queue.

edmund.kwok’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new939 bytes

As per #4, changed it to 'class'. Tested and class is applied to top level parent div. Like chx mentioned, feel free to mark this postponed.

Steven’s picture

Status: Reviewed & tested by the community » Fixed

We should do the same for radios too.

I do find it a little weird that the class is applied both to the container and the actual checkbox/radio, but I guess you can select based on tagname (div vs input).

Committed to HEAD, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)