Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3572

Content wrapper hides java attributes and methods from freemarker (e.g. myContent.class.name)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Neutral Neutral
    • None
    • 4.4.2
    • freemarker, templating
    • None

      The "specificities" (see http://documentation.magnolia-cms.com/reference/templating/freemarker.html#WorkingwithMagnoliacontent) of how Magnolia handles content objects in Freemarker templates break all access to regular methods of the java object since the dot-notation is pretty much kidnapped and only node datas are returned. To "fix" that, special content properties starting with @... were introduced.

      It would been cleaner if the "@..." notation would have been used for accessing jcr attributes (i.e. node datas) and the rest would behave normally, so

      ${myContent.class} should return the Class object my calling the getClass() method.
      ${myContent.@class} should return the JCR attribute named "class"

      Of course this might be my personal preference, but fact is that I cannot call the getClass() method the way the wrapper ojbect works now but you could get both (JCR attribute and method()) the other way around.

        Acceptance criteria

              Unassigned Unassigned
              will Will Scheidegger
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD