[MTE-40] Util to retrieve the TemplateDefinition (page, area, component) for a specific node Created: 26/Jul/15 Updated: 18/Aug/15 Resolved: 18/Aug/15 |
|
| Status: | Closed |
| Project: | Magnolia Templating Essentials |
| Component/s: | ftl-templates |
| Affects Version/s: | 0.5 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Sigurd Rolfes | Assignee: | Unassigned |
| Resolution: | Workaround exists | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Date of First Response: |
| Description |
|
Hi Mgnls, for building the navigation I searched for a util function that returns the TemplateDefinition for a specific node, I couldn't find one. Example: in the header I have a list of nodes from the content area to build up the header navigation of a one-pager. The nodes are of type mgnl:area. templatingFunctions.children(content, "mgnl:area") It would be nice to have something like: NodeUtil.getTemplateDefinition(node); that returns the page/area/component definition. Sigurd |
| Comments |
| Comment by Sigurd Rolfes [ 27/Jul/15 ] |
|
mmh, this might already be implemented with ConfiguredTemplateDefinitionProvider |
| Comment by Philip Mundt [ 18/Aug/15 ] |
|
Hi! Yes, indeed, with the help of NodeTypes.Renderable.getTemplate(Node) to get the template and by injecting info.magnolia.rendering.template.registry.TemplateDefinitionRegistry and calling info.magnolia.rendering.template.registry.TemplateDefinitionRegistry#getTemplateDefinition(String) you should be able to get the definition (see info.magnolia.rendering.template.type.TemplateTypeHelper). |
| Comment by Sigurd Rolfes [ 18/Aug/15 ] |
|
ok, thanks. You can close this. Sigurd |
| Comment by Philip Mundt [ 18/Aug/15 ] |
|
See comments above. |