diff --git a/src/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php b/src/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php index cc4208c..a11664f 100644 --- a/src/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php +++ b/src/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php @@ -22,7 +22,15 @@ public function __construct($originalService) { } protected function wrapControllerExecutionInRenderContext($controller, array $arguments) { - if(get_class($controller[0]) === "Drupal\jsonapi\Controller\EntityResource"){ + $class = NULL; + if (is_array($controller) && !empty($controller[0]) && is_object($controller[0])) { + $class = get_class($controller[0]); + } + elseif (is_object($controller)) { + $class = get_class($controller); + } + + if ($class === "Drupal\jsonapi\Controller\EntityResource"){ $context = new RenderContext(); $response = $this->renderer->executeInRenderContext($context, function () use ($controller, $arguments) { return call_user_func_array($controller, $arguments); diff --git a/src/StrawberryfieldFilePersisterService.php b/src/StrawberryfieldFilePersisterService.php index 1ac2626..76cc918 100644 --- a/src/StrawberryfieldFilePersisterService.php +++ b/src/StrawberryfieldFilePersisterService.php @@ -868,7 +868,7 @@ public function persistFilesInJsonToDisks(StrawberryFieldItemList $field) { $this->messenger()->addError( t( 'Your content references a file at @fileurl with Internal ID @file_id that we could not find a full metadata definition for, maybe we forgot to process it?', - ['@fileurl' => $current_uri, '@file_id' => $fid] + ['@fileurl' => $file->getFileUri(), '@file_id' => $fid] ) ); }