Hello,
I passed through a lot of documentation about selectors and a few post in the forum but and I did not find my answer so I'll try here :).
Question: Is there a way to find pages that have a certain field attached to his template ?
Use case:
// Site structure
Products
Computers
Computer #1 (has field cached_details)
Computer #2 (has field cached_details)
Electronics
Test #1
Pet Supplies
Test #2 (has field cached_details but is empty)
// If I want to get all children of page "products" that contains the field "cached_details" I would do something like this
// $products => PageArray
$results = $products->children("has_field=cached_details");
// or this
$results = $products->children("cached_details!=null");
// Expected: $results would contains [Computer #1, Computer #2, Test #2]
// Instead I have to do this
$results = new PageArray();
foreach($products->children as $child) {
if ($child->hasField("cached_details") === true) {
$results->add($child);
}
}
Thank you in advance guys :),