Jump to content
Sign in to follow this  
sujag

selector syntax has_parent for page reference field

Recommended Posts

I'm having trouble by finding the right syntax for accessing ancestors of a page Reference field in a selector. I need to find all pages with a given template that include a page reference to  some descendants of a given page.

Working query is

  $regionEvents = $pages->find("template=veranstaltung,selectLocation.parent=$page,eventTime>$curYearStart")->sort('selectLocation');

but after changing site structure I need to find not only references to direct children, but also to grandchildren.

I tried "selectLocation.has_parent=$page" but this throws an error "Unknown subfield: has_parent"

Is this simply a syntax problem or do I need another way to find the pages I need?

 

Share this post


Link to post
Share on other sites

Perhaps this old thread can be helpful?

 

Share this post


Link to post
Share on other sites

Thanks, this gave me indeed the necessary hint.

a two step query seems to do, what I'm after

$regionLocations = $pages->find("has_parent=$page");
$regionEvents = $pages->find("template=veranstaltung,selectLocation=$regionLocations,eventTime>$curYearStart")->sort('selectLocation');

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...