How get XF from a component? | Community
Skip to main content
btaymaz1
Level 2
Jun 2, 2021 4:00 PM UTC
Solved

How get XF from a component?

How can I access XF properties from a component inside XF. "currentPage" returns main page.

 

Page > XF Component > XF > Custom Component

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
btaymaz1
btaymaz1Accepted solution
Level 2
Jun 2, 2021 4:40 PM UTC

I did this for now

 

private Page getXFPage(Resource res) { if(res.getResourceType().equals("cq:Page")) { return res.adaptTo(Page.class); } return getXFPage(res.getParent()); }

1 reply

btaymaz1
btaymaz1AuthorAccepted solution
Level 2
Jun 2, 2021 4:40 PM UTC

I did this for now

 

private Page getXFPage(Resource res) { if(res.getResourceType().equals("cq:Page")) { return res.adaptTo(Page.class); } return getXFPage(res.getParent()); }
Translate