Problem/Motivation

Hello! It would be nice to add the token support. They are really useful in styling.
Thanks!

Command icon 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

toomanynights created an issue. See original summary.

kaszarobert’s picture

Version: 1.0.2 » 1.0.x-dev

Can you please describe your use case how tokens would help building and styling layouts?

toomanynights’s picture

Of 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;".

kaszarobert’s picture

Assigned: Unassigned » kaszarobert

I'll look into it.

toomanynights’s picture

Assigned: kaszarobert » Unassigned

Thanks!
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

toomanynights’s picture

Sorry, removed assignee by accident.

snap_x made their first commit to this issue’s fork.

snap_x’s picture

Status: Active » Needs review

Thank 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.

o_timoshchuk’s picture

Assigned: Unassigned » o_timoshchuk
o_timoshchuk’s picture

Version: 1.0.x-dev » 2.0.x-dev
o_timoshchuk’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new106.5 KB
new42.88 KB

The merge conflicts were successfully resolved, and the token integration has been tested. Everything is working correctly on my end.

o_timoshchuk’s picture

Assigned: o_timoshchuk » Unassigned

snap_x’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @o_timoshchuk for fixing conflicts!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.