Problem/Motivation
If I try to access the translation page of a entity type definition I get the following error:
TypeError: Illegal offset type in Drupal\Core\Config\Entity\ConfigEntityStorage->loadOverrideFree() (line 479 of core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php).
If I grasp it correctly this happens because we defined our own parameter loader here:
$route->setDefault('external_entity_type', $this->entityTypeManager
->getStorage('external_entity_type')
->load($entity_type_id));
But the config translation handling expects an entity_id to be given which it can load itself.
Steps to reproduce
- Configure multiligual site
- Enable "External Entities Drupal.org example"
- Go to
/admin/structure/external-entity-types - Select "Translate" in the dropdown of "Drupal.org module - JSONAPI"
Proposed resolution
Instead of loading the entity right away pass on the entity id but declare it's underlying type:
$route->setOption('parameters', [
'external_entity_type' => [
'type' => 'entity:external_entity_type'
]
]);
This should allow the parameter resolvers to properly manage the parameter.
Remaining tasks
- ✓ Write code
- Review
- Merge
User interface changes
None
API changes
None
Data model changes
None
Issue fork external_entities-3506171
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
das-peter commentedComment #4
guignonvLooks fine to me. I just reviewed the code and did not test it yet but I believe it would work.
Comment #6
guignonvComment #7
colanYes, it works. Just tested it!