Recently Browsing 0 members
No registered users viewing this page.
ProcessWire added the numReferences property in 3.0.107, which returns the count of all pages having a reference to the page object. However, apparently it's not possible to use this property inside a selector. I'm trying to find all pages that are referenced at least once:
$pages->find('template=service, numReferences>0'); This throws an error: "Field does not exist: numReferences".
Is there another way to filter by the number of references? Of course, I could manually filter the results of the find query, but that feels overly complicated. Ideally, I would also like to filter the number of references from a specific field; that is, find all pages that are referenced at least once in one specific page reference field.
Is there a way to do this? I guess supporting numReferences in selectors would be a feature request - if so, is it feasible?
I played with the Selectors object and would like to use it for a special use case...
That is a custom Selectors object with dummy data converted to an php array to see the structure (Selectors object is a WireArray with "fields" added)
Array (  => Array (  => Array ( [field] => seg1 [value] => val1 [not] => [group] => [quote] => [forceMatch] => )  => Array ( [field] => seg2 [value] => val2 [not] => [group] => [quote] => [forceMatch] => ) ) )
But instead of "seg1" the field name is "field" with value "seg1" (= my field name).
So I can't search the Selectors WireArray (= custom WireArray with added Selectors objects) with PW "find('seg1=val1')", Is there a way to search with "find()" or build a simple wrapper to make the elements searchable / filterable with find()?
I'm struggling with this : a 'group' field of 'Page' type.
The parent of selectable pages is '/groups', the template is 'group', and a member can create some groups in the /groups tree. I would like this user to see only the groups he or she has created so in my 'Find selector' in the backend, I would like to use :
template=group, created_users_id=$user->id But that doesn't seem to work... I still get the list of all available groups in the /groups tree.
Any idea ?
I had a feeling I had already seen that before (something like $user->id must be replaced by users_id or something, but I can't find anything in the Forums... and all my tests keep failing...
Apologies if this has been covered. I tried a search but didn't hit the usecase I'm after.
I currently have category pages listing their children products. Someone asked me to put a product in multiple categories, so I created a Page Reference field called prod_othercategories which lets a user pick multiple product category pages.
When I try to output a list of products for a category page, I came around to the following selector:
$pages->find("prod_othercategories|parent=$page, template=prod_series, sort=title, prod_status_pages!=1554|1559|1560|4242"); Only the first selector item is giving me trouble, but I'm including the entire string in case something is conflicting and I'm not realizing it.
The output is currently only outputting matches for "parent" and ignoring prod_othercategories. I tried listing parent first in the selector but it had no effect.
Appreciate if someone could help me with this! Thanks!