- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - πͺπΈSpain joe_carvajal Seville (Spain)
I confirm that the bug is still present in Drupal 10.1.6.
The patch in #32 works and applies to D10.1.* perfectly. - last update
over 1 year ago 30,341 pass - π§πͺBelgium flyke
The patch from #32 seems to apply on Drupal 11.1.6.
Unfortunatly, my project also used the media_contextual_crop module for cropping media images, which in turn requires the media_library_media_modify module, which in turn requires drupal core patch from #3263397 π Simplify form logic in media library Needs work which seems to conflict with this patch, so if this patch applies, then the other one doesn't and my project then isn't working well enough to verify how good patch from #32 works on Drupal 11.1.6.
But since the patch from #32 applied, I did test it on my project as I was having very similar issue:
- I created a custom block type 'Hero' which has a Media field among others. That block is available via layoutbuilder to place anywhere on any page. Its created via a custom module that we use in lots of our projects.
- New project comes along that requires a hero slider. So the ability to add multiple Hero items and have them slide, for example via Bootstrap Carousel. So I create a new custom block type 'Hero slider' and add a multi value entity reference field (hero_slides) that references block_content of type 'hero'. The hero_slides field form display formatter is set as 'Inline entity form - Simple'.
- I edit my layoutbuilder page
- Add a 'Hero slider' block
- In the modal to create this hero slider block I set up 1 Hero item without problem: setting a title and the background image via 'Add Media' and selecting an image from the media library. I save the hero slider (that has only one slide/Hero) and there is no problem.
- I edit my page again and the hero slider block and now I add a second item/Hero
- I click to select background image via 'Add Media' for the second Hero. This does not work, and now the background image field for the first Hero is also empty.When I say 'This does not work' I mean there was no media library popup. When clicking the 'Add media' button there was a successful (status 200) ajax POST to /nl/layout_builder/update/block/overrides/node.11/0/blb_region_col_1/f3265287-a9f2-4c0f-9d3e-d76230525936
But that resulted in both hero1 and hero2 having no background images. When I saved the hero slider block anyway, and then edited it again, the second hero/slide was not added/saved.
I did relize that my background image field was actually a 'Media with contextual modifications' field instead of a media library reference field. So I edited my Hero block type and added a 'Mediatest' field which is a proper Media field. I edited my Hero slider, that has one slide at the moment, and selected a Media image for the Mediatest field and saved it. No problem, when I edited my hero slider block again, the Mediatest image was still there.
Again I tried adding a new Hero/slide and clicked on 'Add media' for the Mediatest field of the second Hero. This time, the Media library select image modal did open. I selected an image and clicked 'Insert selected'. Result now was that the second hero did NOT have the selected image (Mediatest field still empty), and my first hero/slide was altered. Its original Mediatest image was unchanged, but remember that my Heo blocks also have a 'Background image' field that is a 'Media with contextual modifications' field? Well THAT field of my first hero now ended up having the image that I selected for the Mediatest field of the second hero. I saved anyway and again my second hero/slide was lost.