[SOLVED] Add Classes and Attributes if node property exists


(Patric Eckhart) #1

Hey guys!

How can I add classes and attributes if node property exists, e.g. for animate.css

prototype(Neos.Neos:Content)  {
   attributes.class.@process.class = ${value + (q(node).property('valignment') ? ' ' + q(node).property('valignment') : '' ) + (q(node).property('mt') ? ' ' + q(node).property('mt') : '' ) + (q(node).property('mb') ? ' ' + q(node).property('mb') : '' ) + (q(node).property('ml') ? ' ' + q(node).property('ml') : '' ) + (q(node).property('mr') ? ' ' + q(node).property('mr') : '' ) + (q(node).property('class') ? ' ' + q(node).property('class') : '' ) + ' os-animation'}
   attributes.data-os-animation.@process.value = ${value + (q(node).property('animation'))}
   attributes.data-os-animation-delay.@process.value = ${value + (q(node).property('delay')) + 's'}
}

Similar:
if property animation = true add class os-animation

Thanks,
Pat


(Patric Eckhart) #2

I found the mistake, I’m an idiot.

... + (q(node).property('animation') ? ' ' + 'os-animation' : '' )}