Expand my Community achievements bar.

SOLVED

How get XF from a component?

Avatar

Level 3

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 3

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

1 Reply

Avatar

Correct answer by
Level 3

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