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.
"sort_bef_combine" in page urls is good enough for development, but it's inappropriate for production. The end user will not understand this.
It would be nice to change it to, let's say, just "sort". Is there a way to alter this using hook_form_alter() or some other API functions?
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff.txt | 2.08 KB | JeroenT |
#10 | any_way_to_change_the-2372781-10.patch | 9.18 KB | JeroenT |
#8 | interdiff.txt | 1.24 KB | JeroenT |
#8 | any_way_to_change_the-2372781-8.patch | 8.41 KB | JeroenT |
#6 | any_way_to_change_the-2372781-6.patch | 8.44 KB | JeroenT |
Comments
Comment #1
mikeker CreditAttribution: mikeker commentedI don't believe there is an easy way to change the query string param via
hook_form_alter()
or similar because of the way that Views renders exposed form elements. But I haven't tried, so if you do find a way, please report back!Marking this as a feature request -- it would not be that hard to make the combined sort ID a user-configurable field.
This only appears in the query string as a argument name. As such, it doesn't usually have much user interaction. Or am I missing somewhere else it shows up?
Comment #2
quotesBro CreditAttribution: quotesBro commentedNo, I am only talking about argument name in the query string.
Comment #3
ethanhinson CreditAttribution: ethanhinson commentedThis feature would really help me out right now. I have 2 different Views exposed forms with BEF on the same page and I am experiencing collisions caused by non-unique query parameters.
Comment #4
ethanhinson CreditAttribution: ethanhinson commentedAfter some research, this required a bit of find and replace, but wasn't too bad. This patch will provide a new option under the Advanced fieldset for setting the HTML name of the combined form element.
Comment #5
mikeker CreditAttribution: mikeker commented@ethanhinson: Thank you for the patch. In the future, feel free to set the issue to "needs review" if there's a patch or something for the maintainer to review.
If we're going to add this, we should add it for all the theme functions, not just checkboxes.
These (and lots of others -- I stopped after a few) are unrelated.
I didn't have time to do much more than a drive-by review. If you could clean up the unrelated stuff, it would make it easier to review the rest of your changes.
Thanks.
Comment #6
JeroenTCreated a new, smaller patch.
Comment #7
mikeker CreditAttribution: mikeker commentedLooks much better, thanks, @JeroenT! But there still are some problems I came across after some basic testing:
On a new view, settings BEF as the "Exposed form style" and clicking apply results in an error ("Enter a query parameter to use for combined sorts. field is required.").
That may be solved by:
Form field title should not end with a period.
$settings is not defined at this point in the code. But this would be a good place to put the currently used default value.
Also, this patch fails the automated tests for BEF (specifically the Link and Rewrite tests) though I haven't had the time to look into those.
Comment #8
JeroenTFixed 1 and 2 in #7.
Let's see which tests are still failing.
Comment #9
JeroenTThis should fix the failing tests.
Comment #10
JeroenTComment #11
mikeker CreditAttribution: mikeker commentedAwesome! Thank you @JeroenT and @ethanhinson! Committed with a slight modification to the
#description
text so that we don't get a bunch of issues when people put all sorts of crazy characters in the combined sort field... :)Comment #14
dizee CreditAttribution: dizee commentedDid this patch make it in to the D8 module? I'm not seeing this option anywhere.
Comment #15
SoCalErich CreditAttribution: SoCalErich commentedAny way to get this to work in D9?