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

SOLVED

How get XF from a component?

Avatar

Level 2

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

 

Page > XF Component > XF > Custom Component

1 Accepted Solution

Avatar

Correct answer by
Level 2

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());
}

View solution in original post

0 Replies

Avatar

Correct answer by
Level 2

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());
}