Problem/Motivation

In #3306820: Show machine name in "Manage form display" and "Manage display" table row, Drupal core is adding a "Machine name" column.

When I apply this patch for core (or use the latest version), while field_group is enabled, the table looks broken, because in the field group table rows, content ends up in the wrong table cell.

We should support this additional column with field_group, possibly as a conditional feature, to support different versions of core.

Steps to reproduce

Use current Drupal from before the change.
Install field group.
Create some content displays that use field groups.
Upgrade to latest 11.x (possibly soon 10.4.x?), or patch it with 3306820.
Check "Manage display".
Play with "Show row weights" and "Hide row weights".

Expected:
- Table cells in field group rows are aligned with the cells for field rows.
- The machine names do show up.
- The "Show row weights" and "Hide row weights" works correctly.

Actual:
- Table cells are misaligned.
- The machine names are hidden if "Hide row weights" is used. They show up if "Show row weights" is used.

(not sure if it will always be like this but at least it won't work correctly I think)

Proposed resolution

Conditionally add the additional column / cell in the rows added by field_group.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

donquixote created an issue. See original summary.

donquixote’s picture

The change seems simple, but the conditionality is more tricky.

We should have some kind of feature detection support in core.

donquixote’s picture

StatusFileSize
new564 bytes

This patch is a first proof of concept, definitely not to be committed as-is.
It lacks the conditionality, and it lacks tests.

It is ok for people who want to patch both core and field_group to get the machine name column.

anybody’s picture

Version: 8.x-3.x-dev » 4.x-dev
Status: Active » Needs work

Nice @donquixote! :) Can you please turn this into a MR?

duaelfr made their first commit to this issue’s fork.

duaelfr’s picture

Status: Needs work » Needs review

@anybody There you go.
Now #3306820: Show machine name in "Manage form display" and "Manage display" table row has been released. This causes an issue where the weight field for the field_group line is displayed. Dragging the field_group around is still functional but it can be troubling for end users.

nils.destoop’s picture

Status: Needs review » Needs work

The fix will need to be smarter. As the column only exists for 11.1. We don't want to break the screens of sites running an older version.

duaelfr’s picture

Status: Needs work » Needs review

I don't know why I was convinced that 4.X was D11 only. My bad.
Is it better like this?

donquixote’s picture

I would suggest to use some kind of feature detection instead of version detection.
This way we also support sites that apply a patch.
Not sure yet how that would work..

scott_euser made their first commit to this issue’s fork.

scott_euser’s picture

Not the cleanest as there is no array key, but would this be okay?

joevagyok’s picture

Status: Needs review » Reviewed & tested by the community

The solution is looking good for me! Thanks @scott_euser and everybody involved.

ikam’s picture

I've tried the patch https://www.drupal.org/project/field_group/issues/3471822#comment-15755143 and it works for me (using Drupal 11.1.5 and Firefox 136.0)

grevil’s picture

Status: Reviewed & tested by the community » Fixed

Agreed, LGTM! Thanks everyone!

  • grevil committed d34e0638 on 4.x authored by duaelfr
    Issue #3471822: Add "machine_name" column in field_ui to support Drupal...
grevil’s picture

joevagyok’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.