Markets List and Detail Plugin

This commit is contained in:
orasche committed 2026-08-05 16:53:02 +02:00
1 parent a739dd8fe3
commit 27cc22dc69
66 files changed
+1078 -5494

No files matched your search

@@ -10,8 +10,10 @@ use Doctrine\DBAL\ParameterType;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Service\FlexFormService;
use Evomedien\Vitec\Service\RteResolver;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Service\ImageService;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* UserFunc to render a single market as JSON for headless output.
@@ -155,9 +157,11 @@ class MarketShowJsonRenderer
return [
'uid' => $uid,
'title' => (string)($market['title'] ?? ''),
'slug' => (string)($market['slug'] ?? ''),
'subtitle' => (string)($market['subtitle'] ?? ''),
'teaser' => (string)($market['teaser'] ?? ''),
'description' => (string)($market['description'] ?? ''),
'description' => RteResolver::html($market['description'] ?? ''),
'detailUrl' => $this->detailUrl((int)($market['detail_page'] ?? 0)),
'categories' => $this->getMarketCategories($uid),
'image' => $this->getMarketImage($uid),
];
@@ -267,4 +271,25 @@ class MarketShowJsonRenderer
];
}, $categories);
}
/**
* Resolve the `detail_page` uid to a URL. The frontend cannot do anything
* with a raw page uid, so the link is built server side — same convention
* as `headerLink` and LocationsJsonRenderer.
*
* Returns null when no page is set or the link cannot be resolved.
*/
private function detailUrl(int $pageUid): ?string
{
if ($pageUid <= 0) {
return null;
}
try {
$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$url = $cObj->typoLink_URL(['parameter' => (string)$pageUid]);
return $url !== '' ? $url : null;
} catch (\Throwable $e) {
return null;
}
}
}