Problem/Motivation
Hello! It would be nice to add the token support. They are really useful in styling.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Screenshot From 2026-04-03 12-23-13.png | 42.88 KB | o_timoshchuk |
| #12 | Screenshot From 2026-04-03 12-21-56.png | 106.5 KB | o_timoshchuk |
Issue fork layout_custom_section_classes-3306306
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kaszarobertCan you please describe your use case how tokens would help building and styling layouts?
Comment #3
toomanynights commentedOf course!
Simple example: my nodes have a field that define the node's subtype. I'd like to be able to hide a section if the node is of subtype A. For that, rendering this field's value into the section's class attribute is the easiest solution: then I'll just create a class "subtype-A" and style it as "display: none;".
Comment #4
kaszarobertI'll look into it.
Comment #5
toomanynights commentedThanks!
If that helps, I know of at least two modules that add classes to the Layout Builder's field blocks (not sections though), that also support tokens:
https://www.drupal.org/project/fdk
https://www.drupal.org/project/field_formatter_class
Comment #6
toomanynights commentedSorry, removed assignee by accident.
Comment #9
snap_xThank you for raising this feature request. The use case of applying dynamic CSS classes based on entity field values is a great one.
I've implemented token support and created an MR.
Comment #10
o_timoshchuk commentedComment #11
o_timoshchuk commentedComment #12
o_timoshchuk commentedThe merge conflicts were successfully resolved, and the token integration has been tested. Everything is working correctly on my end.
Comment #13
o_timoshchuk commentedComment #15
snap_xThanks @o_timoshchuk for fixing conflicts!