Improve Views dropdown listing

Created on 27 June 2023, almost 2 years ago
Updated 2 June 2024, 12 months ago

Problem/Motivation

In the "Drupal View" SS element, I found it odd that the views display name is listed first, then the view name follows it in parenthesis.

Additionally, the sort order seems odd. It should be in alphabetical order, but this is not immediately obvious that the sort is based on machine name because the display name is shown first. Even if it were to show view name first before display name, then the sort would still not be perfect because sometimes the views's machine name is quite different than the view's title.

Finally, as a nice-to-have, it would be interesting to also see the Title field if not empty. This is especially helpful when the display title is the default of "Block" and the title field has a non-empty value set, which is just the case for many views out of the box from Acquia CMS.

Proposed resolution

1.- Use the following format for the field dropdown:

View name - Display name - Display title

2.- Remove the default block title "Block" from the list, it doesn't add any value.

3.- Remove duplicate words when Display name or Display title are the same as the View name.

4.- Sort the list of displays using asort() with the natural language sort option.

5.- Consider adding the machine name in parentheses to the end.

This would solve a case when a view has multiple blocks, both with the default display name of "Block" and without a display title set. Since the machine name is the only thing guaranteed to be unique.

View name - Display name - Display title (view_machine_name:block_machine_name)

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡¨Ecuador jwilson3

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024