Commit 8c5aefaa authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Make tstemplate respect hidden flags for sys_template records

Previously, the tstemplate Object Browser would wrongly show hidden
typoscript templates, if they were the first one to be found
(which determined by the sorting key).
The hidden flag will now only be ignored, if a hidden template is
explicitly requested by its uid (using the template selector switch).

Resolves: #88507
Releases: main, 11.5
Change-Id: Ibbfeb2de7f8ee79a1e343ff23f9d1064219eb344

Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Tested-by: core-ci's avatarcore-ci <>
Tested-by: Benni Mack's avatarBenni Mack <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
parent d85d3626
......@@ -19,6 +19,8 @@ use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\VisibilityAspect;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Localization\LanguageService;
......@@ -143,15 +145,21 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController
// Defined global here!
$this->templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
$this->templateRow = $this->templateService->ext_getFirstTemplate($pageId, $template_uid);
$hasFirstTemplate = is_array($this->templateRow);
// No explicitly selected template on this page was found, so we behave like the Frontend (e.g. when a template is hidden but on the page above)
if (!$hasFirstTemplate) {
// Re-initiatlize the templateService but do not include hidden templates
$context = clone GeneralUtility::makeInstance(Context::class);
$context->setAspect('visibility', GeneralUtility::makeInstance(VisibilityAspect::class));
$this->templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class, $context);
// Gets the rootLine
$rootlineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pageId);
$rootLine = $rootlineUtility->get();
// This generates the constants/config + hierarchy info for the template.
$this->templateService->runThroughTemplates($rootLine, $template_uid);
// Get the row of the first VISIBLE template of the page. whereclause like the frontend.
$this->templateRow = $this->templateService->ext_getFirstTemplate($pageId, $template_uid);
return is_array($this->templateRow);
return $hasFirstTemplate;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment