Problem/Motivation
Enabled content_translation, menu_item_field and token modules.
When i used 'Provide a menu link' at original language, then goto translation, content_translation will broken.
menu_link_content: Drupal\Core\Entity\EntityStorageException: Invalid translation language (und) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 847 of /mnt/www/html/mhicom01live/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Because content_translation will try to get source language when user want to translate an entity, at core/modules/content_translation/content_translation.module::content_translation_entity_presave()
but in token_node_menu_link_submit(), did not set the source language for menu translation, so content_translation get the source language was 'und', then at Drupal\content_translation\FieldTranslationSynchronizer::synchronizeFields()::177, getTranslation by und will throw error.
Steps to reproduce
- Enable content_translation, menu_item_field and token modules.
- Enable English and Japanese.
- Create a menu type, add field_image file field.
- Create an English node.
- Create a menu item by menu type above, and node reference by the node above, and setup the field_image.
- Goto node translation, add a Japanese node, save will show error.
Proposed resolution
None.
Remaining tasks
- Fix issue.
- Add test script.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|
Issue fork token-3168340
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 #2
Oscaner commentedComment #3
berdirlets guard this with a module exists check for content_translation, not sure if you can get here without that, but who knows.
First line needs to end with a . and could maybe also improved a bit to describe what it does. Something like "Sets content translation metata"?
Needs @param with type and description for the arguments.
Comment #6
dieterholvoet commentedThe
moduleExistscheck already exists within the_token_node_menu_link_translation_handlerfunction.I addressed this feedback in the MR.