Warning: Undefined array key in formElement()

Created on 17 February 2024, 4 months ago

Problem/Motivation

Many pages are broken with these errors:

Warning: Undefined array key "custom_eck_entity" in Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceWidget->formElement() (line 133 of /web/modules/contrib/dynamic_entity_reference/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php).
Warning: Trying to access array offset on value of type null in Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceWidget->formElement() (line 133 of /web/modules/contrib/dynamic_entity_reference/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php).
TypeError: Unsupported operand types: null + array in Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceWidget->formElement() (line 135 of /web/modules/contrib/dynamic_entity_reference/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php).
Warning: Undefined array key "custom_eck_entity" in Drupal\dynamic_entity_reference\Plugin\Field\FieldType\DynamicEntityReferenceItem->targetTypeFieldSettingsForm() (line 338 of /web/modules/contrib/dynamic_entity_reference/src/Plugin/Field/FieldType/DynamicEntityReferenceItem.php)
Warning: Trying to access array offset on value of type null in Drupal\dynamic_entity_reference\Plugin\Field\FieldType\DynamicEntityReferenceItem->targetTypeFieldSettingsForm() (line 338 of /web/modules/contrib/dynamic_entity_reference/src/Plugin/Field/FieldType/DynamicEntityReferenceItem.php).
Warning: Undefined array key "custom_eck_entity" in Drupal\dynamic_entity_reference\SelectionPluginManager->getSelectionHandler() (line 28 of /web/modules/contrib/dynamic_entity_reference/src/SelectionPluginManager.php).
Warning: Trying to access array offset on value of type null in Drupal\dynamic_entity_reference\SelectionPluginManager->getSelectionHandler() (line 28 of /web/modules/contrib/dynamic_entity_reference/src/SelectionPluginManager.php).
Deprecated function: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getInstance() (line 45 of /web/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php).
TypeError: uasort(): Argument #1 ($array) must be of type array, null given in uasort() (line 65 of /web/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php).

Steps to reproduce

Proposed resolution

Will try to fix the problem for my site and see.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: duplicate

Version

4.0

Component

Code

Created by

πŸ‡±πŸ‡ΉLithuania mindaugasd

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

Comments & Activities

  • Issue created by @mindaugasd
  • πŸ‡±πŸ‡ΉLithuania mindaugasd

    This is because I used "Exclude" checkbox within "Field Storage" for Dynamic entity reference and selected entities to exclude.
    So all newly created entity types became automatically included, but does not have prior configuration saved.
    So creating new entity type results in all configuration forms and entities themselves being unsuable (fatal errors).

  • Status changed to Closed: duplicate 4 months ago
  • πŸ‡±πŸ‡ΉLithuania mindaugasd

    I applied the patch from related issue to fix the errors.

Production build 0.69.0 2024