Use this:
${myCoolContentMap["jcr:primaryType"]}
It also works for any variable, property name.
Marvin Kerkhoff
Manager Content Solutions
Certified Magnolia Developer
-------------------------------------------------
arvato systems Schweiz AG
Technoparkstrasse 1
8005 Zürich
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von adrien beber (via Magnolia Forums)
Gesendet: Donnerstag, 27. Februar 2014 17:05
An: Magnolia User List
Betreff: [magnolia-user] Magnolia CMS: Getting a node type in freemarker
If I have a node of type javax.jcr.Node, I usually do:
[code][#assign nodeType =
myCoolJcrNode.getProperty("jcr:primaryType").getValue().getString()][/code]
If I have a node of type info.magnolia.jcr.util.ContentMap, similarly I will do:
[code][#assign nodeType =
cmsfn.asJCRNode(myCoolContentMap).getProperty("jcr:primaryType").getValue().getString()][/code]
Any quicker/cleaner way to do this?
Thanks
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=a752b982-f9e1-45ca-b9d1-e921a8e141ea
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------