fix: date tables and group booking links on TYPO3 13

- Uri\ProductViewHelper builds links with the Extbase UriBuilder (no
  controller context in v13), also from content elements
- Null-safe reads of missing row fields and plugin settings, with the
  values PHP 7.4 produced
- /gruppe/ without a product redirects to the search page again
  instead of failing on findByIdentifier(null)

Checked against the TYPO3 10 project: 355 of 359 /gruppe/{product}
pages identical (the rest differ by newer content), all product pages
render, 377 of 396 date tables load (the 19 others fail on TYPO3 10
too: products without a hotel).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-21 15:03:10 +02:00
1 parent 34f2d55f2c
commit e70c5f48d5
7 files changed
+92 -72

No files matched your search

@@ -61,7 +61,7 @@ class ContextProcessor implements DataProcessorInterface
if ($regionUid > 0) {
$processedData['context']['region'] = $this->getContextRecord($regionUid, 'tx_epproducts_domain_model_region');
}
if ($data['tx_eptheme_context_pacode']) {
if ($data['tx_eptheme_context_pacode'] ?? null) {
$processedData['context']['paCode'] = $data['tx_eptheme_context_pacode'];
} elseif ($paCode = $this->getPaCodeFromRequest()) {
$processedData['context']['paCode'] = $paCode;
@@ -27,6 +27,12 @@ namespace EP\EpTheme\ViewHelpers\Uri;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\ExtbaseRequestParameters;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
@@ -73,10 +79,9 @@ class ProductViewHelper extends AbstractViewHelper
];
}
$targetPageUid = is_array($product) ? (int)$product['detailPage'] : $product->getDetailPage();
$uri = $this->renderingContext
->getControllerContext()
->getUriBuilder()
$uri = GeneralUtility::makeInstance(UriBuilder::class)
->reset()
->setRequest($this->getExtbaseRequest())
->setTargetPageUid($targetPageUid)
->uriFor('detail', $linkArguments, 'Product', 'epproducts', 'product_detail')
;
@@ -89,4 +94,19 @@ class ProductViewHelper extends AbstractViewHelper
return $uri;
}
/**
* The view helper is also used in content elements, which render without an Extbase request
*/
private function getExtbaseRequest(): RequestInterface
{
$request = $this->renderingContext->getAttribute(ServerRequestInterface::class);
if ($request instanceof RequestInterface) {
return $request;
}
if ($request->getAttribute('extbase') === null) {
$request = $request->withAttribute('extbase', new ExtbaseRequestParameters());
}
return new Request($request);
}
}