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
- Install entity_reference_hierarchy with the entity_reference_hierarchy_revisions submodule enabled on Drupal 11.
- Ensure PHP assertions are enabled (zend.assertions = 1).
- Visit any content type's "Add field" page.
- 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:
Issue fork entity_reference_hierarchy-3626908
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
Comment #3
brian.seek commentedComment #4
skyriter commentedI can confirm that this works in our project.
Comment #5
skyriter commented