[Neos] setting bootstrap wrap classes globally for all content elements

Dominic Garms djgarms at gmail.com
Fri Dec 6 03:09:17 CET 2013


On 12/06/2013 01:18 AM, Bastian Waidelich wrote:
> Dominic Garms wrote:
>
>> I digg a bit deeper and try to create a Bootstrap package which adds
>> content wrapper to all content types [...]
>>
>> Now I am not sure how to proceed. I found prototype(TYPO3.Neos:Content)
>> and there are already some attributes:
>>
>> prototype(TYPO3.Neos:Content) < prototype(TYPO3.TypoScript:Template) {
>>      node = ${node}
>>
>>      attributes = TYPO3.Neos:Attributes
>>      attributes.class = ''
>
>
> Look a few lines further and you see a (somewhat crazy) example of a
> processor:
>
> attributes.class. at process.nodeType = ${String.trim(value + ' ' +
> String.toLowerCase(String.pregReplace(q(node).property('_nodeType.name'), '/[[:^alnum:]]/',
> '-')))}
>
> This snippet generates classes like "typo3-neos-nodetypes-headline" for
> your content elements
>
>
> If you don't need that behavior you can disable it with:
>
> prototype(TYPO3.Neos:Content) {
>      attributes.class. at process.nodeType >
> }
>
> and/or you can add your own processors. Or simply set the class
> attribute explicitly:
>
> prototype(TYPO3.Neos:Text) {
>      attributes.class = 'custom-class-for-text'
> }
>
>
> BTW: we'll simplify the nodeType processor to something like
> attributes.class. at process.nodeType =
> ${String.slugify(q(node).property('_nodeType.name'))}
>
Hi Bastian,

for my purpose I have following setup:
2 properties: "bootstrapLayout" + "bootstrapVisibility"
Both are integers and can get chosen through the BE via selectboxes.

Now I need to

a) get from each selectbox the specific class name
	example: ${q(node).property('bootstrapLayout')} == 1 => "alert 
alter-danger"

I tried this with TypoScript CASE but couldn't succeed. I thought maybe 
I could use FlowQuery inside of property names, but failed too:
attributes.class < layoutClass.${q(node).property('bootstrapLayout')}.value


b) merge both class names into one name and use it for 
attributes.class. at process.className = MyMergedClassName

Are there any techniques I could use to get this done? In CMS I always 
succeed using the CASE statement, but the syntax is very different now.

Thanks
Dominic


More information about the Neos mailing list