Problem/Motivation

The entity_reference_hierarchy_revisions submodule's field type plugin declares:

/**
 * @FieldType(
 *   id = "entity_reference_hierarchy_revisions",
 *   label = @Translation("Entity reference revisions tree"),
 *   description = @Translation("An entity field containing a hierarchical entity reference to a specific revision"),
 *   category = "Reference revisions",
 *   ...
 * )
 */

Since Drupal 10.2, field type plugin category values must be machine names declared in a MODULE_NAME.field_type_categories.yml file (see Field type categories change record). "Reference revisions" is a human-readable label, not a declared category, and no field_type_categories.yml exists.

When PHP assertions are enabled, this trips an AssertionError in \Drupal\Core\Field\FieldTypePluginManager:

AssertionError: "Reference revisions" must be defined in MODULE_NAME.field_type_categories.yml in assert() (line 183 of core/lib/Drupal/Core/Field/FieldTypePluginManager.php).

This surfaces whenever Field UI builds the "Add field" list, blocking any field on affected content types, not just fields of this type.

Steps to reproduce

  1. Install entity_reference_hierarchy with the entity_reference_hierarchy_revisions submodule enabled on Drupal 11.
  2. Ensure PHP assertions are enabled (zend.assertions = 1).
  3. Visit any content type's "Add field" page.
  4. Observe the fatal AssertionError.

Proposed resolution

Change the plugin's category to reuse core's existing reference category (already used by drupal/entity_reference_revisions's own field type), rather than inventing a new undeclared category:

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

brian.seek created an issue. See original summary.

brian.seek’s picture

Status: Active » Needs review
skyriter’s picture

I can confirm that this works in our project.

skyriter’s picture

Status: Needs review » Reviewed & tested by the community