Problem/Motivation

Opening any "Add field" admin page (e.g. /admin/structure/taxonomy/manage/*/overview/fields/add-field) on Drupal 11 throws a fatal AssertionError and the modal fails to load:

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

The root cause is in SimpleTimeFieldItem.php, which declares its @FieldType category using a translated label:

category = @Translation("General"),

Since Drupal 11, FieldTypePluginManager::getGroupedDefinitions() groups field types by their category value and validates each group key against registered category plugin IDs from *.field_type_categories.yml files. The plugin ID defined in core.field_type_categories.yml is general (lowercase), but @Translation("General") resolves to the string "General" (capital G) — which does not match any registered plugin ID, triggering the assertion.

Steps to reproduce

  1. Install Drupal 11 with simple_time_field 1.3.0 enabled.
  2. Navigate to any entity's "Manage fields" page (e.g. /admin/structure/taxonomy/manage/work_type/overview/fields).
  3. Click "Add field".
  4. Observe the AssertionError — the field type selection modal is blank.

Comments

boychev created an issue. See original summary.

boychev’s picture

Proposed resolution

Change the category annotation from a translated label to the plugin ID string, consistent with how all Drupal core field types declare their category (e.g. category = "reference", category = "date_time"):

- *   category = @Translation("General"),
+ *   category = "general",
boychev’s picture

Status: Active » Needs review
sujan shrestha’s picture

Version: 1.3.0 » 1.4.x-dev
Status: Needs review » Fixed

Fixed in 1.4.x and released in 1.4.0:
https://git.drupalcode.org/project/simple_time_field/-/commit/6cc259ff24...
https://www.drupal.org/project/simple_time_field/releases/1.4.0

Your diagnosis was right: the field type declared its category as a translated label, while Drupal 11 expects the category plugin ID. The field type now uses a PHP attribute with category: 'general', as core does. A new functional test opens the "Add field" page, so this is covered from now on.

The same cause also produced the TypeError in #3584027, which is fixed by the same change.

Thanks @boychev for the clear report and the patch.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.