Fix two PHP errors on Drupal 11.2

Created on 8 September 2025, 26 days ago

Problem/Motivation

If you try to add a new field to an existing entity type, it fails with the following error:

AssertionError: "TripAdvisor" must be defined in MODULE_NAME.field_type_categories.yml a assert() (línia 183 de /var/www/html/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php).

Once this error is fixed, another error shows up:

TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 45 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Steps to reproduce

Under Drupal 11.2.4 and tripadvisor_integration 8.x-1.3, add a new field to any existing content type and the error will show up. You won't be able to add new fields.

Proposed resolution

1. Add a tripadvisor_integration.field_type_categories.yml file in module's root folder.
2. Edit /src/Plugin/Field/FieldType/TripAdvisorItem.php file and remove some of the @Translation tags.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain rcodina Barcelona

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024