[SOLVED] Add CSS Class to Neos.Neos:Content

Hey guys,

I have added a string property named “CSS-Class” in Neos.Neos:Content. I would like, to define a separate CSS class for each content element, if is necessary. But how can I now wrap each Neos.Neos:Content Element?

'Neos.Neos:Content':
ui:
  inspector:
    groups:
      settings:
        label: Fundamental.Site:Main:settings
        icon: 'icon-cog'
properties:
  addClass:
    type: string
    ui:
      label: Fundamental.Site:Main:addClass
      reloadIfChanged: TRUE
      inspector:
        group: 'settings'

You might not need to wrap each content element. Maybe you only add the class to the existing classes. like:

Fusion:

prototype(Neos.Neos:Content)  {
    attributes.class.@process.addClass = ${value + (q(node).property('addClass') ? ' '+q(node).property('addClass') : '' )}
}

Template.html:

<div{attributes -> f:format.raw()}>
...
</div>

Thank you. It works fine :slight_smile: