[MAGNOLIA-6213] Standardize TemplatingFunctions Created: 20/May/15 Updated: 12/Apr/17 Resolved: 22/Jun/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | templating |
| Affects Version/s: | None |
| Fix Version/s: | 5.4 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Christopher Zimmermann | Assignee: | Christopher Zimmermann |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | templating-refactor | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |
|
TemplatingFunctions should be updated to adhere to the new standard: For 5.4, in this ticket - all new functions should have names standardized, work with both nodes & contentMaps, and have good comments. Older functions deprecated and new versions created: getQueryStringAndFragment New functions in 5.4 renamed: getLinkPrefix getReferencedContent findParentWithTemplateType getTemplateType getTemplateSubType getContentListByTemplateTypeAndSubType getContentListByTemplateId getContentListByTemplateIds getFileExtension getDisplayFileSize Additionally TemplateTypeHelper#getContentListByTemplateTypeAndSubType method is renamed to be in synch with the version in TemplatingFunctions: |
| Comments |
| Comment by Philip Mundt [ 29/May/15 ] |
|
Doesn't compile due to checkstyle (Missing dots):
/** * Wraps the provided node with an inheritance wrapper so that the node appears to * contain the components and/or properties that exist in the equivalent nodes of the * ancestors of the provided node's "anchor". * (The anchor is the first parent of type mgnl:content - typically the page node of the provided node). * The inheritance is subject to the inheritance configuration of the node, but can be overridden with the parameters of this method. * (See {@link info.magnolia.rendering.template.configured.ConfiguredInheritance}.) * For more details, see {@link info.magnolia.templating.inheritance.DefaultInheritanceContentDecorator} Note: The inherit methods are seldom necessary because areas already support inheritance natively through configuration. * * @param relPath If not blank, the node will inherit the node specified by this relative path rather than the actual provided node. * This could be used to grab a specific property from a subnode. * @param nodeTypes If not blank, only ancestors of the anchor with one of the nodeTypes in this comma delimited string will be evaluated. * @param nodeInheritance Specify which child components of the ancestors to inherit. * Accepts [ConfiguredInheritance.COMPONENTS_ALL | ConfiguredInheritance.COMPONENTS_NONE | ConfiguredInheritance.COMPONENTS_FILTERED] * "all": Inherit all components. "filtered": Inherit only components with property inheritable=true. "none": Do not inherit components. * @param propertyInheritanct Specify which properties of the ancestors to inherit. * Accepts [ConfiguredInheritance.PROPERTIES_ALL | ConfiguredInheritance.PROPERTIES_NONE] * "all": Inherit all properties of ancestors, if multiple ancestors provide the same property - that from the nearest ancestor is used. * "none": Do not inherit properties. */ See: javadoc-inherit-before.png /** * Wraps the provided node with an inheritance wrapper so that the node appears to contain the components and/or * properties that exist in the equivalent nodes of the ancestors of the provided node's "anchor" (The anchor is * the first parent of type mgnl:content - typically the page node of the provided node). * * <p>The inheritance is subject to the inheritance configuration of the node, but can be overridden with the * parameters of this method.</p> * <p><b>Note</b>: The inherit methods are seldom necessary because areas already support inheritance natively * through configuration.</p> * * <p>Node inheritance accepts: * <dl><dt>{@link ConfiguredInheritance#COMPONENTS_ALL}</dt><dd>Inherit all components</dd> * <dt>{@link ConfiguredInheritance#COMPONENTS_FILTERED}</dt><dd>Inherit only components with property * <code>inheritable=true</code></dd> * <dt>{@link ConfiguredInheritance#COMPONENTS_NONE}</dt><dd>Do not inherit components</dd></dl></p> * * <p>Property inheritance accepts: * <dl><dt>{@link ConfiguredInheritance#PROPERTIES_ALL}</dt><dd>Inherit all properties of ancestors, if multiple * ancestors provide the same property the one from the nearest ancestor is used</dd> * <dt>{@link ConfiguredInheritance#PROPERTIES_NONE}</dt><dd>Do not inherit properties</dd></dl></p> * * @param relPath If not blank, the node will inherit the node specified by this relative path rather than the * actual provided node. This can be used to grab a specific property from a subnode. * @param nodeTypes If not blank, only ancestors of the anchor with one of the nodeTypes in this comma delimited * string will be evaluated. * @param nodeInheritance Specify which child components of the ancestors to inherit. * @param propertyInheritance Specify which properties of the ancestors to inherit. * * @see info.magnolia.templating.inheritance.DefaultInheritanceContentDecorator * @see info.magnolia.rendering.template.configured.ConfiguredInheritance */ See: javadoc-inherit-after.png |
| Comment by Philip Mundt [ 29/May/15 ] |
|
Missing adjustments due to refactoring of method name getLinkPrefix():
|
| Comment by Christopher Zimmermann [ 22/Jun/15 ] |
|
Cleaned up javadoc and changed parameter names on a few functions. Decided to stick with the See syntax for many functions because it is the most important part of the javadoc and I felt it was more helpful to have it be emphasized and be the first thing one rather than down in the "see also" section. Added " for details." to make the statement a sentance: "See {link}for details." |
| Comment by Christopher Zimmermann [ 23/Jun/15 ] |
|
Created and linked tickets for Site and Multisite |
| Comment by Espen Jervidalo [ 24/Jun/15 ] |
|
pushed a squashed and cleaned up version to |