Five reference fields are shown twice when ERwH is installed

Created on 16 June 2021, over 3 years ago
Updated 24 October 2023, about 1 year ago

I've installed Entity Reference (with) Hierarchy 1.0.0 beta3 (not Entity Reference (with) Hierarchy Revisions yet) on a Drupal 9.1.10 install. I've then created a new content type and wanted to test and play around with ERwH. When I try to add a new field I get five of the available reference fields displayed twice (see screenshot โ†’ ). When I uninstall ERwH afterwards all available reference fields are shown only once again (see screenshot โ†’ )

๐Ÿ› Bug report
Status

Needs review

Version

1.0

Component

User interface

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

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.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States coderdan

    To reproduce the issue:

    1. Perform a fresh install of Drupal 9 using standard install profile
    2. Install the latest version entity_reference_hierarchy
    3. Visit /admin/structure/types/manage/article/fields/add-field
    4. In the 'Add new field' select list, under the 'Reference' section, see that there are two entries for 'Content', 'Taxonomy term', and 'User' entity types.

  • @coderdan opened merge request.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States coderdan

    This issue is stemming from the core change that introduced "preconfigured fields" back in D8. See https://www.drupal.org/project/drupal/issues/2446511 โ†’ .

    Since ERwH is dependent on entity_reference_revisions, but not overriding the getPreconfiguredOptions() method, ERwH is picking up the preconfigured field settings from ERR, which cause these "duplicate" fields.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States coderdan

    Attaching patch for convenience/composer purposes.

  • Thanks @coderdan.

    Using D9.5.11 with entity_reference_hierarchy 1.0 beta3:
    at first glance this patch seems to work with no side effects.

    Will report back if I find any issues.
    J.

Production build 0.71.5 2024