Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm building a custom views module and when I expose a sort field, there are too many values added to the $this->params['sort']
array.
I am using solr-data, but fields and filters work just fine. For example when I expose just one sort fields, $this->params['sort']
will contain both the default sort (as field name + sort) and the active sort (also as field name + sort). This messes up the actual queries I'm sending to the solr instance.
Any ideas? Is this a bug or did I do something wrong?
Comment | File | Size | Author |
---|---|---|---|
#3 | views-exposed-filters-multiple.jpg | 49.5 KB | Danny_Joris |
#3 | views-sort-not-exposed.jpg | 41.71 KB | Danny_Joris |
#1 | views-exposed-filters.jpg | 143.8 KB | Danny_Joris |
Comments
Comment #1
Danny_Joris CreditAttribution: Danny_Joris commentedscreenshot attached
Comment #2
Danny_Joris CreditAttribution: Danny_Joris commentedOr: how do I figure out which function calls a handler and when, so I can trace this sort handler call back?
Comment #3
Danny_Joris CreditAttribution: Danny_Joris commentedTwo more attachments.
- One shows two exposed sort filters. It will always add the default setting of the first exposed filter in the row.
- The other shows two non-exposed filters. The result is fine here.
Comment #4
dawehnerIn general this might be a problem of your custom handlers.
Here is a link to your project: https://github.com/DannyJoris/islandora_solr_views just for reference if someone else has a look at it.
Comment #5
dawehnerSo i'm wondering whether you can reproduce that with a totally normal sql view on something like the node base table.
This at the end would dramatically simplify the route to the bugfix.
Comment #6
dawehnerUpdate status.
Comment #7
Danny_Joris CreditAttribution: Danny_Joris commentedviews_handler_sort::query() also passes the default sort first when exposed. The difference is that when it passes the values to views_plugin_query_default::add_orderby() , the views_plugin_query_default::orderby property gets populated, it doesn't seem to be the same property?
When I check $this->orderby in the same page load, it populates orderby with the default value first, but the second sort value doesn't seem to be added to this array, instead it looks like a new empty array.
Comment #8
esmerel CreditAttribution: esmerel commentedComment #8.0
esmerel CreditAttribution: esmerel commentedfixed wrong formatting