- ๐จ๐ฆCanada vincent signoret
Hello, thank you for the work.
I wondering if we can have this patch for the 3.0.x ? - ๐ณ๐ฑNetherlands arantxio Dordrecht
So I've worked on a patch for the latest 3.x dev version as of today. I think I've gotten everything that was in the issue fork. Patches are attached.
When testing I noticed some layout issues while having GIN and Claro installed on our site. So I've also created a patch for when that happens. Example also attached, So if you have the same issue as use while having GIN as your admin theme, then try that patch or use it as a example if your issue is different from ours.
- Status changed to Needs review
over 1 year ago 7:01pm 16 April 2023 - First commit to issue fork.
- @robpowell opened merge request.
- ๐บ๐ธUnited States robpowell Boston
I updated media_library_edit-3316163 with latest 3.x changes, gin fixes in #14 and a typo in render array
'attached'
vs'#attached'
.To test I did the following:
- translated a node
- on the edit page for that node I went to the media field. For each media that didn't have a translation, there was a button to translate
- clicking the "translate" button shows a modal and allows for editing the translation.
- saving the node and inspecting the image shows the translated translation
- reviewing the entity at /admin/content/media confirms that there is a translation
Note: On Gin theme the dropdown button active state looks a bit off:
- Status changed to Needs work
about 1 year ago 12:11pm 28 August 2023 - ๐ซ๐ฎFinland sokru
Accidentally created a new issue ๐ Error: Call to undefined method Drupal\field_ui\Form\FieldConfigEditForm::getFormLangcode() in media_library_edit_field_widget_single_element_form_alter() (line 123 of modules/contrib/media_library_edit/media_library_edit.module) Closed: duplicate , when the cause was this issue. The patch on #14 needs something like:
--- a/media_library_edit.module +++ b/media_library_edit.module @@ -17,6 +17,7 @@ use Drupal\Core\Field\WidgetInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; +use Drupal\field_ui\Form\FieldConfigEditForm; use Drupal\media\Entity\Media; use Drupal\media_library\MediaLibraryUiBuilder; @@ -116,6 +117,9 @@ function media_library_edit_field_widget_single_element_form_alter(array &$eleme $element['#attributes']['class'][] = 'js-media-library-edit-' . Html::cleanCssIdentifier($context['items']->getFieldDefinition()->getName()) . '-wrapper'; /** @var \Drupal\Core\Entity\ContentEntityFormInterface $form_object */ $form_object = $form_state->getFormObject(); + if ($form_object instanceof FieldConfigEditForm) { + return; + }
- ๐จ๐ฆCanada vincent signoret
I couldn't install the patch on Drupal 10.1.2 on 3.0.2
I don't know if it's related to #19 - ๐ณ๐ฑNetherlands arantxio Dordrecht
I've added the changes from โจ Add option to select form display mode Fixed . Which adds the option to set the form_mode.
Tested it on our local environment and seems to be working fine.
This should make it work on the latest dev branch.we will still have to look at the problems in comment #18. with the allignment.
and I also haven't looked into #19 yet.
- ๐ณ๐ฑNetherlands arantxio Dordrecht
Here is the patch, because the MR needs to be updated first. @robpowell could you update your MR to target the dev branch origin/3.0.x ? I don't seem to be enable to do so, I could create a new MR, but that wouldn't be the best option IMO.
- ๐ซ๐ฎFinland sokru
Added the remaining tasks. We found out a new issue with the patch (22): the Body field WYSIWYG (CKEditor 5) buttons disappear after editing&saving the translated media item alt-text in dialog. I can reproduce the issue with 10.1.5 and 10.2.x, and removing the patch (#22) will fix the issue.
- ๐ซ๐ฎFinland sokru
Have been trying to debug the CKEditor field converting into plain textarea after submitting the media field translation dialog.
What I have tried so far:
- Drupal with different core versions (9.5.x, 10.1.6, 10.2.)
- Switch the WYSIWYG field to use CKEditor 4
- Hardcoding the core/ckeditor5 dependency to module and #attached libraries.Once this is resolved I think it would greatly help to tackle the regression if we could add the tests. Wrote the manual steps how to reproduce the issue.
composer require drupal/admin_toolbar drupal/media_library_edit:3.0.x-dev drush/drush vendor/bin/drush en content_translation media_library_edit media_library -y cd modules/contrib/media_library_edit curl -O https://www.drupal.org/files/issues/2023-09-11/3316163-22.patch patch -p1 < 3316163-22.patch # Add a new language http://localhost:8888/admin/config/regional/language/add # Allow translating node:article http://localhost:8888/admin/structure/types/manage/article # Allow translating media:image http://localhost:8888/admin/structure/media/manage/image # Create a new media reference field with media:image # Make sure "Users may translate this field" is checked http://localhost:8888/admin/structure/types/manage/article/fields/add-field # Make sure "Show edit button" is checked on Media field http://localhost:8888/admin/structure/types/manage/article/form-display # Add a new article and add media:image http://localhost:8888/node/add/article # Translate the article and edit the media field. # After submitting the media dialog, the CKEditor field changes to plain textfield.
- ๐ซ๐ฎFinland sokru
For anyone looking a temporary solution with WYSIWYG editor disappearance, I've created a following core patch.
- ๐จ๐ญSwitzerland Lukas von Blarer
Lukas von Blarer โ made their first commit to this issueโs fork.
- Merge request !17Resolve #3316163 "Add contenttranslation support 2" โ (Open) created by Lukas von Blarer
- ๐จ๐ญSwitzerland Lukas von Blarer
I decided to create a new branch and MR based on the existing MR. I didn't make any changes.
- ๐ณ๐ฑNetherlands arantxio Dordrecht
I've merged the changes from the latest commit on the Dev branch.
I excluded the part for the FormattableMarkup as we display it different, also it creates a visually hidden span element, which makes it obviously visually hidden.
#14 for gin works for me ( media_library_edit 3.0.3 and D 10.2.5 )
I hope it will be released soon, This is such an essential feature in my mind.
- ๐ณ๐ฑNetherlands arantxio Dordrecht
@daisyleroy If you would like to use the MR, you would have to use the dev branch for media_library_edit, as it is one change ahead of the release tag.
I do have to say, we experienced some visual bugs with the MR like in #18. So some work on styling has to be done first imo.
- ๐ช๐ธSpain rcodina Barcelona
@Arantxio I tried the MR17 but the patch fails to apply:
I executed this command to get the 3.0.x version which is the target branch of MR17:
composer require 'drupal/media_library_edit:dev-3.0.x'
Then I added the patch like this:
"drupal/media_library_edit": { "Add content_translation support": "https://git.drupalcode.org/project/media_library_edit/-/merge_requests/17.patch" }
But composer gives an error:
Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/project/media_library_edit/-/merge_requests/1...
- ๐ญ๐บHungary nagy.balint
MR17 was based on 3.0.2, and the merge with 3.0.x did not work out apparently.
- ๐ณ๐ฑNetherlands arantxio Dordrecht
I've update the MR to be based back on the 3.0.x branch, which should work no problem, as we have been using it for some time.
The dev branch can be checked out as followed:
"composer require 'drupal/media_library_edit:3.0.x-dev@dev'"Here is the current git tree:
And how its set within our composer file:
- ๐ณ๐ฑNetherlands arantxio Dordrecht
I've also created a patch based on #14 but then for 3.0.3 and with the fix mentioned in #19, hope this helps