Configured renderable definitions
Page, component and area definitions represent the static configuration for these objects. They are instantiated with the content2bean mechanism, so you can define and use your own subclasses if needed. This can be useful, for example, if your pages, areas or components need specific configuration that you don't want to expose to editors in dialogs: the same script and the same dialog can be re-used to render totally different looking components, for example. The definition instances must be stateless as they are reused across the system.
Renderable elements (pages, areas, components) can also take advantage of a model. This is a similar to the "action" in an action-based Web framework. Model classes are instantiated per rendering. As such, they can be used to perform actions based on input, load some data, or simply provide utility methods to the templates.
The following class diagram shows the relationships between the objects collaborating in the rendering of a template.
The sequence diagram below shows the template rendering process starting from when the request passes through the
AggregatorFilter in Magnolia's filter chain.
Templating support objects
There are a couple of objects that are made available to template scripts, to simplify their development:
| || Current node exposed as a map like
| || Current page exposed as a map like
| ||Current RenderableDefinition. (template or paragraph definition object)|
| ||The bean created by the renderer based on the modelClass defined on the paragraph or template definition. The current content, definition and the parent model are passed to the constructor.|
| ||The result of the model's execute method. This string can be used to determine the template (in the definition) or in the template itself.|
| ||An object providing access to various components or utility methods, for example to create links. See MagnoliaTemplatingUtilities.|
| || Current Context. Depending on the type of request, a different implementation will be used but for a web request to a page this will be a WebContext instance. In a web request, you can use
| ||Current AggregationState.|
| || Provides access to STK templates. The
| || Messages from the current message bundle like the "Read on" message.