- Issue created by @seanB
- Merge request !8223Issue #3450772: Media items created via the media library widget should have... → (Open) created by seanB
- Status changed to Needs review
10 months ago 3:32am 30 May 2024 - 🇳🇱Netherlands seanB Netherlands
Created a MR. Let's see if this breaks anything.
- Status changed to Needs work
10 months ago 1:27pm 30 May 2024 - 🇺🇸United States smustgrave
Makes sense to me.
Can we add a test case to show that behavior?
Thanks!
- First commit to issue fork.
- 🇪🇸Spain vidorado Logroño (La Rioja)
First of all, congratulations to @seanb! The media library code was not trivial, and their fix was both well-executed and clean.
After manually testing, I noticed that the
langcode
was not being properly set in the translation add form. To fix this, I modified the code to retrieve thelangcode
from the form_state storage, which turned out to contain the target translation’s langcode.Since the documentation states that "no specific support is provided for it in the Form API" regarding the
FormState::storage
variable, I added a fallback to the original fix $entity's language, which is for sure always available:$form_state->get('langcode') ?? $entity->language()->getId(),
Additionally, I’ve included an FJ test. :)
- 🇪🇸Spain vidorado Logroño (La Rioja)
vidorado → changed the visibility of the branch 11.x to hidden.