Reputation: 2494
I am creating some Magnolia templates and would like to know if any one has found a way to create a @cms.newBar
and somehow use a node as the list of available paragraphs. The syntax is as below:
[@cms.newBar newLabel="Add Content" paragraph="template1, template2" /]
I want to use the node instead to avoid having to come back and add new templates when they are created.
I have seen the docs here and know that nothing is specified but wanted to see if anyone had found a way?
Upvotes: 0
Views: 225
Reputation: 1657
You can do several things, all boiling down to the same:
configure a string property containing "template1, template2", in your template definition. Assuming you're using Freemarker as the templating language, refer to it with ${def.thatProperty}
(def references your template definition)
have your model class return that value: ${model.whatsCooking}
, where your model class has a method String getWhatsCooking()
which returns "template1, template2" (or whatever else you could come up with that decides what paragraphs should be available
STK does something similar to (1) - its template definitions contains List
s of "available" paragraphs, and its templates use some utility method to turn that into a comma-separated list, use with the new bar, so something like ${stk.toStringList(def.main.paragraphs)}
(I can't recall the exact names and semantics, but you get the gist).
You should perhaps consider looking into STK for that, and a whole lot of things.
As for documentation, perhaps the templating guide and other docs will be more useful than the javadoc/tlddoc in this case.
HTH,
Upvotes: 3