Views exposed sort identifiers are not configurable

Created on 26 July 2017, over 7 years ago
Updated 11 September 2023, about 1 year ago

Problem/Motivation

The exposed sort identifiers are not configurable in the same way as the exposed filters identifiers. This leaks some internal IDs in the URL and that we can consider part of the UI, even is in the browser address bar, not in the page. For example, with Search API, the user might see such parameter/value in the query string &sort_by=search_api_relevance, which is not elegant at all.

Proposed resolution

Allow the exposed sort identifiers to be configured.

Remaining tasks

None.

User interface changes

New, textfield element in the exposed sort configuration subform.

API changes

New parameter string $handler_type in \Drupal\views\Plugin\views\display\DisplayPluginBase::isIdentifierUnique() signature.

Data model changes

None.

Release notes snippet

When exposing a sort in the exposed form, the site builder is able to configure the identifiers that are exposed in the URL as query parameter values.

Original report

While working on a Rest API via Views, I noticed that exposed Sorts could not have custom identifier likes Filters could. As such, I have created a (probably terrible) patch to add in this functionality.

Please comment on items that need to be changed or fixed and I will be happy to do so!

✨ Feature request
Status

Fixed

Version

9.3

Component
ViewsΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡¨πŸ‡¦Canada PaulDinelle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024