TranslateEntityProcessor is not compatible with dynamic_entity_reference

Created on 3 May 2024, about 2 months ago

Problem/Motivation

When enabling TranslateEntityProcessor on a field created with the dynamic_entity_reference module, it triggers this exception:

Drupal\Component\Plugin\Exception\PluginNotFoundException:
The "" entity type does not exist.

  at core/lib/Drupal/Core/Entity/EntityTypeManager.php:139
  at Drupal\Core\Entity\EntityTypeManager->getDefinition(null)
     (core/lib/Drupal/Core/Entity/EntityTypeManager.php:253)
  at Drupal\Core\Entity\EntityTypeManager->getHandler(null, 'storage')
     (core/lib/Drupal/Core/Entity/EntityTypeManager.php:192)
  at Drupal\Core\Entity\EntityTypeManager->getStorage(null)
     (modules/contrib/facets/src/Plugin/facets/processor/TranslateEntityProcessor.php:114)
  at Drupal\facets\Plugin\facets\processor\TranslateEntityProcessor->build(object(Facet), array(object(Result), object(Result)))
     (modules/contrib/facets/src/FacetManager/DefaultFacetManager.php:339)

Steps to reproduce

Create a field with dynamic_entity_reference.
Add this field to a search_api index.
Create a facet for this field and check "Transform entity ID to label".

Proposed resolution

A solution would be to create a new FacetsProcessor that extends TranslateEntityProcessor and gets the entity type from each value instead of the field definition.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France prudloff Lille

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

Comments & Activities

Production build 0.69.0 2024