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
BedrockMission!

Learn More

View all

Sign in to view all badges

Fetching Parent Page Properties from Experience Fragment Component

Avatar

Avatar
Validate 1
Level 1
rajaram33
Level 1

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
rajaram33
Level 1

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
rajaram33
Level 1

22-02-2021

Hi All,
I have a header component which uses a experience Fragment and in this XF i have a header component mapped. This Experience Fragment is been used inside my home page editable template. Now i am trying to access a page properties from my home page inside this header component mapped to Experience Fragment

Page Template > XF > Header Component(Access Page Properties).

Below is my code inside the header component model

@Self Resource resource; @PostConstruct protected void init() { try { InheritanceValueMap iProperties = new HierarchyNodeInheritanceValueMap(resource); String value = iProperties.getInherited("txPath",String.class);
I am always getting null value for txPath. I had checked the property value under /content/myprj/us/en/jcr:content and the value of txPath exists.
I am not sure whether i can access the property of a page from experience fragment component since both follows a different /content path(Not hierarchy).
Suggest Please

 

 

Experience Fragments page properties

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

271 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

271 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Anudeep_Garnepudi
MVP

22-02-2021

@rajaram33 

To get current page properties, you can use pageProperties object in any of the component. All the properties of current page will be set pageProperties global object while sling resolves the resource and will be passed along all the resources in the page.

To get inherited pages properties, you can use inheritedPageProperties object. 

You can directly use these objects in HTL or can inject in Sling Model.

Answers (0)