Skip to content

Commit

Permalink
Merge pull request #292 from esmero/ISSUE-291
Browse files Browse the repository at this point in the history
ISSUE-291: Allow Early Rendering Wrapper to deal with both types of $controllers
  • Loading branch information
DiegoPino authored Jan 5, 2024
2 parents 6e3824c + c3f08dc commit 58a80a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/StrawberryfieldFilePersisterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
);
}
Expand Down

0 comments on commit 58a80a8

Please sign in to comment.