Improve the clarity and perhaps the functionality in the context of the field union view mode

Created on 24 April 2024, over 1 year ago

Problem/Motivation

If you have two field unions/composites, in my example Card game and Vinyl record, and you then create a composite field, then pick Card game as the option in the field creation process, in consequence you might run into several potentially confusing details when you revisit the composite field at a later point. Or in case you are joining a team and you become responsible for the content model of the site from now on, but someone else set up the composite field(s) and field unions/composites before.

On the field settings there is no indication which field union / composite is used for this composite field:

On the form display page the form mode for the composite field just shows default:

On the display page you have a select field labeled as field union view mode which contains the options default, Card Game and Vinyl record:

The potential problems in context of the last screenshot:

  • The term view mode you usually associate with the pattern that you are having a basic set of fields and then you are able to decide in the context of each view mode which fields of that basic set you want to have enabled and disabled. with field union view modes you decide which of the field unions /composites created you actually use for this composite field. the term view modes, is creating potentially misleading associations by having it used in two completely different contexts on the very same page.
  • What the actual field union/composite is used for a composite field, is not directly apparent. the only clue is on the manage display page in the list of options, but you dont see what is selected instead you just see "default" and the list of available composite components.
  • Based on the first two points if you have created a composite field and picked Card game, then on the manage form display page the Default form mode setting automatically picks up the Card game composite component, but what if a user is picking by accident or deliberately Vinyl record as the field union view mode on the manage display page? That would be conflicting with the settings on the manage form display page and the composite field in general? Cuz field unions / composite components could have a complete different set of fields?

And in addition to that you have the ability to enable and disable the fields within a field union /composite while on a content type you are only able to enable or disabled the composite field and thereby enable or disable the set of fields associated with the composite field. View modes are not available to field unions /composites, you only have a single set of fields you are able to enable and disable. When you add a composite field you then have two different levels, for one you have the manage form display and manage display pages listing the added composite field, which fields are contained is not directly apparent, communicated, nor adjustable based on the context (content type and or view mode), you have to open a separate browser window to get into the field union /composite.

Steps to reproduce

Proposed resolution

One potential step to improved the current state might be to add the select list for setting the field union/composite on the composite field settings page. Just show the available field unions in the list of available options, but don't show the default option characteristic for view modes. And as soon as a node is created for a content type using this composite field, disable the select field and just display the field union in use for this composite field. Plus rename the label for the select list from field union view mode to maybe something like Composite type to avoid any association with the concept of view modes?

One question, out of the scope for this issue, but speaking of view modes, should always the entire set of fields of a composite field being displayed or would it be desired to display in view mode A field 1, 3 and 5 while in view mode B field 1, 2 and 4 of a field union / composite?

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Component

User interface

Created by

🇩🇪Germany rkoller Nürnberg, Germany

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

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

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024