[MAGNOLIA-6484] Provide templating function to get first occurrence of a node property Created: 07/Jan/16  Updated: 04/Mar/19

Status: Open
Project: Magnolia
Component/s: templating
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Federico Grilli Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by MTE-72 Use templating function to get teaser... Closed
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   

Something like

    / * @return a String representation of the first property occurrence, else null. Will search recursively all <code>mgnl:</code> nodes types under the passed root node.
     */
public String findFirstProperty(Node root, String propertyName) throws RepositoryException

This will come in handy in situations like the one we have in demo-travel where the teaser component searches for a teaser image id. Currently this is done within the Freeemarker template with a recursive function but that has some limitations besides introducing perhaps too much complexity in an ftl.



 Comments   
Comment by Jan Haderka [ 07/Jan/16 ]

Why not using simply cmsfn.search() for that?

Generated at Mon Feb 12 04:14:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.