Replace "Select a field type" with a hierarchical select

Created on 27 March 2013, over 11 years ago
Updated 12 September 2023, over 1 year ago

Spin-off from #1847590: Fix UX of entity reference field type selection . In comment 7 of that issue, amateescu suggested:

I also see another option for the UI: have a single "Reference" entry in the main select widget which exposes a secondary list of all possible entity types

That issue has moved in another direction, but I think this idea could be useful regardless, and for more than just the ER field type(s).

If you currently install Drupal HEAD and enable all field type modules, you get 18 options for "Select a field type":

- Boolean
- Date
- Decimal
- E-mail
- Entity Reference
- File
- Float
- Image
- Integer
- Link
- List (float)
- List (integer)
- List (text)
- Long text
- Long text and summary
- Telephone number
- Term reference
- Text

What if we replaced this with an initial select containing:

- Boolean
- Date
- E-mail
- File...
- Link
- Number...
- Reference...
- Telephone
- Text...

A top-level selection of "File..." would open up a second Select right next to it containing:

- File
- Image

A top-level selection of "Number..." would open up:

- Decimal
- Float
- Integer
- List (float)
- List (integer)

A top-level selection of "Reference..." would open up:

- Comment
- Content
- Term
- User
(plus others TBD)

A top-level selection of "Text..." would open up:

- List (text)
- Long text
- Long text and summary
- Text

Notes:

  • Especially in the case of the secondary select for "Text...", I think the alphabetical ordering results in an unfortunate order, but let's ignore that in this issue. I also think the "List (*)" labels are confusing, because you're not creating a list, you're creating whatever type is in the parens, and then just restricting the content author to select from a preset list of options, but again, that's a preexisting condition of HEAD that can be discussed in a separate issue.
  • Above, I put File and Image into a File group and Term into the Reference group. That's partially based on #1847590-14: Fix UX of entity reference field type selection , though what to do about Term might need more discussion.
  • In terms of implementation, my current assumption is that the final selection corresponds to a distinct field type. So to implement the "Reference..." grouping would require that each entity type reference is a derivative plugin (sub-field-type), per #1847590-3: Fix UX of entity reference field type selection . So, the groupings is just a UI suggestion, not something that requires any deep changes in Field API. Perhaps just a hook to allow modules to define/alter the groups.
Feature request
Status

Closed: duplicate

Version

11.0 🔥

Component
Field 

Last updated 1 day ago

Created by

🇺🇸United States effulgentsia

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

  • html5

    Implements and supports the use of HTML5.

  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

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