Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Inheritance – AEM | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Inheritance – AEM by Kiran Vedantam

Abstract

There are many ways inheritance is implemented in AEM. For today’s topic, we would be discussing a couple of use-cases on how to access the properties from either ancestral pages or components

Use case1:

Accessing a page property that is authored on the home page into its child pages using java code.

Solution: HierarchyNodeInheritanceValueMap

An InheritanceValueMap for a given page resource that will inherit values from ancestral pages.

On my /content/allaem/us/en page, I have added a property

A new object is created for HierarchyNodeInheritanceValueMap and current page content resource is passed into it as a parameter.

Here, the InheritanceValueMap checks for “jcr:description” in

/content/allaem/us/en/home/jcr:content
/content/allaem/us/en/jcr:content
/content/allaem/us/jcr:content
/content/allaem/jcr:content
If the property is found nowhere, null is returned.

This model is now referenced in the text component’s htl in the below way

${text @ context = textModel.isRichText ? 'html' : 'text'}

Inheritance Property is: ${inheritance.description}

Read Full Blog

Inheritance – AEM

Q&A

Please use this thread to ask the related questions.

0 Replies