- 🇬🇧United Kingdom mikee
Thanks for this module and is there any plan to release a version for Drupal 10?
- 🇬🇧United Kingdom mikee
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) - 🇬🇧United Kingdom mikee
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.
- Status changed to Fixed
over 1 year ago 1:41pm 23 May 2023 - Status changed to Fixed
over 1 year ago 1:42pm 23 May 2023