- Issue created by @markusdala
- π¬πGhana jnrfred
I am also having same issue with filters not working. Any value I set does not work and when I try to expose the form I get the error message
"Error message: This identifier is not allowed." - π¬πGhana jnrfred
I can confirm the filter works when viewing the saved views but does not show or work in views back-end where you are building the views. I think the issue is with core.
- πͺπΈSpain abelcain Madrid
There's a problem with the porting of this module to D9, at class ViewsJsonFilter the $operators are declared, and had been changed from previous version of https://www.drupal.org/project/views_json_query/releases/7.x-1.0 β
So now, when reaching class ViewsJsonQuery, and processing each row, a call is made to function ops(). In this function are the same 6 elements as per D7 module, but is not including the following: 'word', 'allwords', 'startswith', 'not_starts', 'ends', 'not_ends', 'not' and 'regular_expression'...
For us, when using that options we have a WSOD with message: "TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given in call_user_func_array() (line 322 of .../web/modules/contrib/views_json_source/src/Plugin/views/query/ViewsJsonQuery.php)."We went then for the use of the grouping filters but we have the issue reported by the colleague in this issue. The AND/OR management at parse() function in class ViewsJsonQuery is not working for us, so we will work on this also...maybe we can deliver a patch here. As soon we get to any conclussion, we'll add an update here.
- πͺπΈSpain abelcain Madrid
The problem is at class ViewsJsonQuery at function parse().
When processing first takes the filter information with
$filter_group = $view->display_handler->getOption('filter_groups');
Which renders this information:
{"operator":"AND","groups":{"1":"AND","2":"OR"}}
And all the processing is using the first group's data, in my case the 'AND':
$group_conditional_operator = $filter_group['groups'][1] ?? "AND";
The problem is that the process is prepared for 1 group only then, and when more than one group is present the 'AND' is maintained (in our case).
We checked with this:
$filter_handlers = $view->getHandlers('filter'); \Drupal::messenger()->addMessage(time() . " Filter hanlers : " . "-" . rand() . json_encode($filter_handlers));
That we have same information than the current process is using BUT it has a variable called 'group' so we can then get the data of each group and get the corresponding data. We're working on a patch to fix this issue and will provide it here soon.
- Assigned to abelcain
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 8:45am 25 September 2023 - Assigned to abelcain
- Status changed to Active
about 1 year ago 9:51am 25 September 2023 - πͺπΈSpain abelcain Madrid
We provide a patch based on the MR5 above mentioned.
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 10:48am 25 September 2023