Thanks to sourabhsisodia_ → multivalue media reference fields are working with this module. For the media field 'Display', select the Formatter 'Rendered Entity'. And then the Formatter of 'Background Image' or 'Responsive Background Image' can be selected for the rendered entity under the 'Display' for the media type of image (Structure->Media Types->Image->Manage Display).
For more information see issue Multivalue field not working for Media items →
@sourabhsisodia many thanks for investigating and resolving this issue.
FYI, on my installation for the module I updated the file 'bg_image_formatter/src/Plugin/Field/FieldFormatter/BgImageFormatter.php' with your updated version of the file and the Multivalue field for Media items is working.
I copied your version from: https://git.drupalcode.org/project/bg_image_formatter/-/blob/c17f8a16707...
To confirm, after making the above update the source code for the page outputs all the images using the appropriate selectors ".bg1, .bg2, .bg3, .bg4, .bg5, .bg6".
The below shows the correct source code being generating by the module (8.x-1.17) + your updated file (BgImageFormatter.php) :
<style media="all">.bg6
{background-image: url('https://d10-cbd-dev.ddev.site/sites/default/files/2021-12/hanex-picker.jpg') ;}</style>
<style media="all">.bg5
{background-image: url('https://d10-cbd-dev.ddev.site/sites/default/files/2021-12/avonite-picker.jpg') ;}</style>
<style media="all">.bg4
{background-image: url('https://d10-cbd-dev.ddev.site/sites/default/files/2022-07/corian-bath-drainer.png') ;}</style>
<style media="all">.bg3
{background-image: url('https://d10-cbd-dev.ddev.site/sites/default/files/2022-07/corian-bath-delight-8430.png') ;}</style>
<style media="all">.bg2
{background-image: url('https://d10-cbd-dev.ddev.site/sites/default/files/2022-07/corian-bath-delight-8420.png') ;}</style>
<style media="all">.bg1
{background-image: url('https://d10-cbd-dev.ddev.site/sites/default/files/2022-07/corian-bath-delight-8410.png') ;}</style>
Many thanks for resolving this issue.
The Features project page advises "The Drupal 8 and 9 version of Features requires the Configuration Update Manager module".
I think this needs to be updated to also include Drupal 10?
As currently reading the project page it appears only Drupal 8 and 9 versions require the Configuration Update Manager module.
I applied the patch and the module works with Drupal 10.
The patch changes the 'custom_nid.info.yml' file to include '^10' as shown below.
core_version_requirement: ^8 || ^9 || ^10
Many thanks. In that case, I will create a fresh site on the same platform with the same modules (as the site with the issue) and see if that gets rid of the problem? FYI, the site where the issue exists was originally a Drupal 7 site that I upgraded to Drupal 10. I'm now wondering whether that might have somehow contributed to the problem? I'll get back to you shortly and let you know what happens. Thanks again.
I also needed to install the patch: 3323148.patch for XML sitemap 8.x-1.4 to work on Drupal 10.
Without the patch the config page /admin/config/search/xmlsitemap gave an error.
Many thanks.
mikee → created an issue.
Hello,
I found the module worked on Drupal 10.0.9 after doing the following:
1. Incorporated the automatic patch: image_field_to_media.1.0.2.rector.patch
2. Within file: '/image_field_to_media.batch.inc' (line 35) added:
- ->accessCheck(TRUE)
Hence, changed (lines 33 - 39) from:
$entity_id = \Drupal::entityTypeManager()->getStorage($entity_type_id)
->getQuery()
->condition('type', $bundle)
->exists($image_field_name)
->range($counter, 1)
->execute();
To:
$entity_id = \Drupal::entityTypeManager()->getStorage($entity_type_id)
->getQuery()
->accessCheck(TRUE)
->condition('type', $bundle)
->exists($image_field_name)
->range($counter, 1)
->execute();
3. Within file: /src/Form/ImageFieldToMediaForm.php changed (line 338) from:
$media_component['weight'] = $image_component['weight'];
To:
$media_component['weight'] = isset($image_component['weight']) ? $image_component['weight'] : 0;
Many thanks for this excellent module.
I updated the image_field_to_media 1.0.2 version (Works with Drupal: ^8 || ^9) with the changes in the automated patch. Then when I went to run it on Drupal 10.0.9 I got the following error:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=72&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 141 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php). Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 38)
image_field_to_media_populate_media_field('node', 'kitchen_gallery', 'field_gallery_photo', 'field_media_kitchen', Array) (Line: 295)
_batch_process() (Line: 137)
_batch_do() (Line: 93)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 686)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Thanks for this module and is there any plan to release a version for Drupal 10?
Many thanks for your help and this patch worked for me.
https://git.drupalcode.org/project/permissions_by_term/-/merge_requests/20.patch