It would great if CSS classes can be added to an element from a dynamic data field.
Even better if we could include conditions on it.
For example I have a card in a query loop using data from a Custom Post Type built with Metabox.
For some items I want the card to be featured. To do this all I need to do is add a class to the card.
It would be nice if I could create one card and on it add a condition that says if this dynamic data field equals true (ie it is a Featured Card) then add this class āfeatured-cardā.
I know there are ways around this like created 2 cards but that is very inefficient since these cards are pricing cards and contain a lot of elements with the only difference being 1 class. I could also do this with a code block by adding the cards code to the block and then pulling the class with PHP like so ā<?php the_field('custom-class-field-name'); ?>ā but once again itās not ideal.
I also did try doing this using attributes and setting the name to āclassā but that is not conditional and it also replaces the entire class list and does not append the custom class to the end of the list. (and actually in some cases using āclassā as the name of the attribute causes Bricks to crash when previewing on the front end)
The solution with attributes does replace the previous inserted class as you mentioned, but it is possible to move all the classes to the attribute field. Yet: