It would be very convenient in the case of end-user controlled layout options. E.g:
<div class="ImageContainer <<PositionClass>>">
<img src="/someimage.png" />
</div>
The position class (like maybe Left, Right, Background) would be set the user by selecting a layout option from a drop down in content element. The problem is, that if you map such an option to the class attribute of the container div, the base class(named ImageContainer in the above example) will be overwritten.
Is it possible to append a value to an existing attribute rather that overwriting it completely?
I’ve seen work-around where the end-user controlled layout option is mapped to the name attribute in stead, but i find this inelegant.
Create your composed class names in TypoScript. This way you are able to compile them from fixed and variable parts and you can even take multiple FCE fields into account.
Here is an example:
DS XML
TypoScript