Hello Team,
I have a page property: isMyPage of Type: String
This page property is enabled/ disabled in language node.
Ex: /content/abc/xyz/fr/en, /content/abc/xyz/fr/fr, Ex: /content/abc/xyz/gb/en
I have written logic in my custom sling model.
@ScriptVariable private Page currentPage;
private InheritanceValueMap inheritanceValueMap;
void init(){
inheritanceValueMap =
Optional.ofNullable(currentPage.getContentResource())
.map(resource -> resource.adaptTo(HierarchyNodeInheritanceValueMap.class))
.orElseGet(
() -> new HierarchyNodeInheritanceValueMap(currentPage.getContentResource()));
if (inheritanceValueMap != null) {
Boolean inheritedValue =
inheritanceValueMap.getInherited("isMyPage", Boolean.FALSE);
}
}
I have enabled the property in these pages
/content/abc/xyz/fr/en,
/content/abc/xyz/gb/en
This works for, when i open the page:
http://localhost:4502/content/abc/xyz/fr/en/home/support
value of inheritedValue is true.
http://localhost:4502/content/abc/xyz/gb/en/home/support
value of inheritedValue is false.
Not sure, why I am getting false in above case.
Thanks
cc @arunpatidar @lukasz-m @SureshDhulipudi
Solved! Go to Solution.
Views
Replies
Total Likes
For this path: /content/abc/xyz/gb/en/home/support
Have you checked in CRX if the isMyPage
property for the home or support page is set to false
?
The logic works as follows:
isMyPage
is not found, the system will retrieve data from the nearest parent.isMyPage
is explicitly set (either in home or support), it will pick the closest available data instead.
For this path: /content/abc/xyz/gb/en/home/support
Have you checked in CRX if the isMyPage
property for the home or support page is set to false
?
The logic works as follows:
isMyPage
is not found, the system will retrieve data from the nearest parent.isMyPage
is explicitly set (either in home or support), it will pick the closest available data instead.
Hi @Sady_Rifat
My bad
Thanks a lot for your quick help.
Please check example here
Views
Likes
Replies