From f35e03bc8fc46490deb310cdba9b1d33a3aeec0d Mon Sep 17 00:00:00 2001 From: Cyril Janody Date: Mon, 9 Feb 2026 15:05:02 -0500 Subject: [PATCH] [BUGFIX] Retrieve the current cObj from the rendering context attribute when possible --- Classes/ViewHelpers/Content/InfoViewHelper.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Classes/ViewHelpers/Content/InfoViewHelper.php b/Classes/ViewHelpers/Content/InfoViewHelper.php index 2b3dfb452..ea1b3328a 100644 --- a/Classes/ViewHelpers/Content/InfoViewHelper.php +++ b/Classes/ViewHelpers/Content/InfoViewHelper.php @@ -11,6 +11,7 @@ use FluidTYPO3\Vhs\Proxy\DoctrineQueryProxy; use FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait; use FluidTYPO3\Vhs\Utility\ContentObjectFetcher; +use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; use TYPO3\CMS\Core\Database\Connection; @@ -72,7 +73,15 @@ public function render() $record = false; if (0 === $contentUid) { - $cObj = ContentObjectFetcher::resolve($this->configurationManager); + if (is_null($this->renderingContext) + || (method_exists($this->renderingContext, 'getRequest') + && is_null($cObj = $this->renderingContext->getRequest()->getAttribute('currentContentObject'))) + || (!method_exists($this->renderingContext, 'getRequest') + && method_exists($this->renderingContext, 'hasAttribute') + && (!$this->renderingContext->hasAttribute(ServerRequestInterface::class) + || is_null($cObj = $this->renderingContext->getAttribute(ServerRequestInterface::class))))) { + $cObj = ContentObjectFetcher::resolve($this->configurationManager); + } if ($cObj === null) { throw new Exception('v:content.info requires a ContentObjectRenderer, none found', 1737807859);