Jump to content

Select pages by children field


alejandro
 Share

Recommended Posts

Hello,

I don´t know if it is posible to find pages that have a children with name, I mean, something like:

$parent = $pages->find("template=opciones, child.name=tarjetas")
 

This of course doesn´t work, but something similar?

Thanks in advance, Alejandro.

  • Like 2
Link to comment
Share on other sites

Well, I found a way. Instead os selecting parents by children fields values, first find the pages, then select the parent:

$children = $pages->find("name=value");
foreach ($children as $child) {
   $parent = $child->parent;
}
 
Link to comment
Share on other sites

Actually you should be able to use "children.name=tarjetas", but I tested it out here and it behaves the same as "parent.name=tarjetas", so that is a bug. Looks like this is the first instance I've seen of needing to use something other than children.count. :) I've now fixed it, but am doing a little more testing locally before committing to dev.  

  • Like 2
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...