- Issue created by @robindh
- Merge request !9Multilingual compatibility for entity reference & media library widgets → (Merged) created by robindh
When using the kontainer entity reference or media library widgets to select an image on a multilingual site, the following error appears: "Oops, something went wrong. Check your browser's developer console for more details".
The JS console error shows:
An AJAX HTTP error occurred.
HTTP Result Code: 200 Debugging information follows. Path: /en/kontainer/create-media?token=mytoken StatusText: success CustomMessage: The response failed verification so will not be processed. ResponseText: {"media_id":"1","media_label":"my-image.jpg","kontainer_file_id":1}"
This points to the drupalSettings.ajaxTrustedUrl
object that does not contain the expected path.
It actually contains /kontainer/create-media?token=mytoken
, but the request path on a multilingual site is /en/kontainer/create-media?token=mytoken
.
Instead of getting the language independent path from routeProvider, construct it using a drupal Url object, which will automatically handle multilingual paths.
I'll attach a merge request to fix this for both entity reference & media library widgets.
Active
1.1
Code