2 declare(strict_types = 1);
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
61 'init' =>
'Using PageLayoutController::init() is deprecated and will not be possible anymore in TYPO3 v10.0.',
62 'main' =>
'Using PageLayoutController::main() is deprecated and will not be possible anymore in TYPO3 v10.0.',
63 'menuConfig' =>
'Using PageLayoutController::menuConfig() is deprecated and will not be possible anymore in TYPO3 v10.0.',
64 'renderContent' =>
'Using PageLayoutController::renderContent() is deprecated and will not be possible anymore in TYPO3 v10.0.',
65 'clearCache' =>
'Using PageLayoutController::clearCache() is deprecated and will not be possible anymore in TYPO3 v10.0.',
66 'getModuleTemplate' =>
'Using PageLayoutController::getModuleTemplate() is deprecated and will not be possible anymore in TYPO3 v10.0.',
67 'getLocalizedPageTitle' =>
'Using PageLayoutController::getLocalizedPageTitle() is deprecated and will not be possible anymore in TYPO3 v10.0.',
68 'getNumberOfHiddenElements' =>
'Using PageLayoutController::getNumberOfHiddenElements() is deprecated and will not be possible anymore in TYPO3 v10.0.',
69 'local_linkThisScript' =>
'Using PageLayoutController::local_linkThisScript() is deprecated and will not be possible anymore in TYPO3 v10.0.',
70 'pageIsNotLockedForEditors' =>
'Using PageLayoutController::pageIsNotLockedForEditors() is deprecated and will not be possible anymore in TYPO3 v10.0.',
71 'contentIsNotLockedForEditors' =>
'Using PageLayoutController::contentIsNotLockedForEditors() is deprecated and will not be possible anymore in TYPO3 v10.0.',
78 'pointer' =>
'Using PageLayoutController::$pointer is deprecated and will not be possible anymore in TYPO3 v10.0.',
79 'imagemode' =>
'Using PageLayoutController::$imagemode is deprecated and will not be possible anymore in TYPO3 v10.0.',
80 'search_field' =>
'Using PageLayoutController::$search_field is deprecated and will not be possible anymore in TYPO3 v10.0.',
81 'search_levels' =>
'Using PageLayoutController::$search_levels is deprecated and will not be possible anymore in TYPO3 v10.0.',
82 'showLimit' =>
'Using PageLayoutController::$showLimit is deprecated and will not be possible anymore in TYPO3 v10.0.',
83 'returnUrl' =>
'Using PageLayoutController::$returnUrl is deprecated and will not be possible anymore in TYPO3 v10.0.',
84 'clear_cache' =>
'Using PageLayoutController::$clear_cache is deprecated and will not be possible anymore in TYPO3 v10.0.',
85 'popView' =>
'Using PageLayoutController::$popView is deprecated and will not be possible anymore in TYPO3 v10.0.',
86 'perms_clause' =>
'Using PageLayoutController::$perms_clause is deprecated and will not be possible anymore in TYPO3 v10.0.',
87 'modTSconfig' =>
'Using PageLayoutController::$modTSconfig is deprecated and will not be possible anymore in TYPO3 v10.0.',
88 'modSharedTSconfig' =>
'Using PageLayoutController::$modSharedTSconfig is deprecated and will not be possible anymore in TYPO3 v10.0.',
89 'descrTable' =>
'Using PageLayoutController::$descrTable is deprecated and will not be possible anymore in TYPO3 v10.0.',
90 'colPosList' =>
'Using PageLayoutController::$colPosList is deprecated and will not be possible anymore in TYPO3 v10.0.',
91 'EDIT_CONTENT' =>
'Using PageLayoutController::$EDIT_CONTENT is deprecated and will not be possible anymore in TYPO3 v10.0.',
92 'CALC_PERMS' =>
'Using PageLayoutController::$CALC_PERMS is deprecated and will not be possible anymore in TYPO3 v10.0.',
93 'current_sys_language' =>
'Using PageLayoutController::$current_sys_language is deprecated and will not be possible anymore in TYPO3 v10.0.',
94 'MCONF' =>
'Using PageLayoutController::$MCONF is deprecated and will not be possible anymore in TYPO3 v10.0.',
95 'MOD_MENU' =>
'Using PageLayoutController::$MOD_MENU is deprecated and will not be possible anymore in TYPO3 v10.0.',
96 'content' =>
'Using PageLayoutController::$content is deprecated and will not be possible anymore in TYPO3 v10.0.',
97 'activeColPosList' =>
'Using PageLayoutController::$activeColPosList is deprecated and will not be possible anymore in TYPO3 v10.0.',
311 public function mainAction(ServerRequestInterface $request): ResponseInterface
314 $this->
init($request);
316 $this->
main($request);
317 return new HtmlResponse($this->moduleTemplate->renderContent());
324 protected function init(ServerRequestInterface $request =
null): void
326 $request = $request ?:
$GLOBALS[
'TYPO3_REQUEST'];
328 $parsedBody = $request->getParsedBody();
329 $queryParams = $request->getQueryParams();
331 $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
332 $this->iconFactory = $this->moduleTemplate->getIconFactory();
333 $this->buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
340 $this->search_field = !empty($sessionData[
'search_field']) ? $sessionData[
'search_field'] :
'';
342 $this->
id = (int)($parsedBody[
'id'] ?? $queryParams[
'id'] ?? 0);
343 $this->pointer = $parsedBody[
'pointer'] ?? $queryParams[
'pointer'] ??
null;
344 $this->imagemode = $parsedBody[
'imagemode'] ?? $queryParams[
'imagemode'] ??
null;
345 $this->clear_cache = $parsedBody[
'clear_cache'] ?? $queryParams[
'clear_cache'] ??
null;
346 $this->popView = $parsedBody[
'popView'] ?? $queryParams[
'popView'] ??
null;
347 $this->search_field = $parsedBody[
'search_field'] ?? $queryParams[
'search_field'] ??
null;
348 $this->search_levels = $parsedBody[
'search_levels'] ?? $queryParams[
'search_levels'] ??
null;
349 $this->showLimit = $parsedBody[
'showLimit'] ?? $queryParams[
'showLimit'] ??
null;
350 $returnUrl = $parsedBody[
'returnUrl'] ?? $queryParams[
'returnUrl'] ??
null;
351 $this->returnUrl = GeneralUtility::sanitizeLocalUrl(
$returnUrl);
361 $this->current_sys_language = (int)$this->MOD_SETTINGS[
'language'];
370 protected function menuConfig(ServerRequestInterface $request =
null): void
372 $request = $request ?:
$GLOBALS[
'TYPO3_REQUEST'];
374 $parsedBody = $request->getParsedBody();
375 $queryParams = $request->getQueryParams();
378 $currentSite = $request->getAttribute(
'site');
379 $availableLanguages = $currentSite->getAvailableLanguages($this->
getBackendUser(),
false, $this->
id);
384 'tt_content_showHidden' =>
'',
386 1 => $lang->getLL(
'm_function_1'),
387 2 => $lang->getLL(
'm_function_2')
390 0 => $lang->getLL(
'm_default')
395 $this->modSharedTSconfig[
'properties'] = $pageTsConfig[
'mod.'][
'SHARED.'] ?? [];
396 $this->modTSconfig[
'properties'] = $pageTsConfig[
'mod.'][
'web_layout.'] ?? [];
403 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'pages');
404 $queryBuilder->getRestrictions()->removeAll()
405 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
406 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
407 $statement = $queryBuilder->select(
'uid',
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField'])
410 $queryBuilder->expr()->eq(
411 $GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'transOrigPointerField'],
412 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
415 while ($pageTranslation = $statement->fetch()) {
416 $languageId = $pageTranslation[
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField']];
417 if (isset($availableLanguages[$languageId])) {
418 $this->MOD_MENU[
'language'][$languageId] = $availableLanguages[$languageId]->getTitle();
422 if (isset($availableLanguages[0])) {
423 $this->MOD_MENU[
'language'][0] = $availableLanguages[0]->getTitle();
432 || !isset($this->MOD_SETTINGS[
'tt_content_showHidden'])
433 || $this->MOD_SETTINGS[
'tt_content_showHidden'] !==
'0'
435 $this->MOD_SETTINGS[
'tt_content_showHidden'] = 1;
453 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_language');
455 $queryBuilder->getRestrictions()->removeAll();
458 $count = $queryBuilder
460 ->from(
'sys_language')
465 unset($actions[
'2']);
468 $blindActions = $this->modTSconfig[
'properties'][
'menu.'][
'functions.'] ?? [];
469 foreach ($blindActions as $key => $value) {
470 if (!$value && array_key_exists($key, $actions)) {
471 unset($actions[$key]);
486 $actionMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
487 $actionMenu->setIdentifier(
'actionMenu');
488 $actionMenu->setLabel(
'');
490 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
493 $foundDefaultKey =
false;
494 foreach ($actions as $key => $action) {
495 $menuItem = $actionMenu
498 ->setHref((
string)$uriBuilder->buildUriFromRoute($this->moduleName) .
'&id=' . $this->id .
'&SET[function]=' . $key);
500 if (!$foundDefaultKey) {
502 $foundDefaultKey =
true;
504 if ((
int)$this->MOD_SETTINGS[
'function'] === $key) {
505 $menuItem->setActive(
true);
508 $actionMenu->addMenuItem($menuItem);
510 if (isset($defaultKey)) {
511 $this->MOD_SETTINGS[
'function'] = $defaultKey;
513 $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($actionMenu);
521 if ($this->clear_cache && !empty($this->pageinfo)) {
522 $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
523 $dataHandler->start([], []);
524 $dataHandler->clear_cacheCmd($this->
id);
538 $view = GeneralUtility::makeInstance(StandaloneView::class);
539 $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
'EXT:backend/Resources/Private/Templates/InfoBox.html'));
543 $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class);
544 $moduleLoader->load(
$GLOBALS[
'TBE_MODULES']);
545 $modules = $moduleLoader->modules;
546 if (is_array($modules[
'web'][
'sub'][
'list'])) {
547 $title = $lang->getLL(
'goToListModule');
548 $message =
'<p>' . $lang->getLL(
'goToListModuleMessage') .
'</p>';
549 $message .=
'<a class="btn btn-info" href="javascript:top.goToModule(\'web_list\',1);">' . $lang->getLL(
'goToListModule') .
'</a>';
550 $view->assignMultiple([
552 'message' => $message,
558 $shortcutMode = (int)$this->pageinfo[
'shortcut_mode'];
559 $pageRepository = GeneralUtility::makeInstance(PageRepository::class);
564 if ($shortcutMode || $this->pageinfo[
'shortcut']) {
565 switch ($shortcutMode) {
568 $message .= $targetPage === [] ? $lang->getLL(
'pageIsMisconfiguredOrNotAccessibleInternalLinkMessage') :
'';
571 $menuOfPages = $pageRepository->getMenu($this->pageinfo[
'uid'],
'*',
'sorting',
'AND hidden = 0');
572 $targetPage = reset($menuOfPages) ?: [];
573 $message .= $targetPage === [] ? $lang->getLL(
'pageIsMisconfiguredFirstSubpageMessage') :
'';
577 $message .= $targetPage === [] ? $lang->getLL(
'pageIsMisconfiguredParentPageMessage') :
'';
580 $possibleTargetPages = $pageRepository->getMenu($this->pageinfo[
'uid'],
'*',
'sorting',
'AND hidden = 0');
581 if ($possibleTargetPages === []) {
582 $message .= $lang->getLL(
'pageIsMisconfiguredOrNotAccessibleRandomInternalLinkMessage');
585 $message = $lang->getLL(
'pageIsRandomInternalLinkMessage');
589 $message = htmlspecialchars($message);
593 $linkedPath =
'<a href="' . htmlspecialchars($linkToPid) .
'">' . htmlspecialchars($path) .
'</a>';
594 $message .= sprintf(htmlspecialchars($lang->getLL(
'pageIsInternalLinkMessage')), $linkedPath);
599 $message = htmlspecialchars($lang->getLL(
'pageIsMisconfiguredInternalLinkMessage'));
603 $view->assignMultiple([
604 'title' => $this->pageinfo[
'title'],
605 'message' => $message,
610 if (empty($this->pageinfo[
'url'])) {
611 $view->assignMultiple([
612 'title' => $this->pageinfo[
'title'],
613 'message' => $lang->getLL(
'pageIsMisconfiguredExternalLinkMessage'),
618 $externalUrl = htmlspecialchars(GeneralUtility::makeInstance(PageRepository::class)->getExtURL($this->pageinfo));
619 if ($externalUrl !==
false) {
620 $externalUrlHtml =
'<a href="' . $externalUrl .
'" target="_blank" rel="noopener noreferrer">' . $externalUrl .
'</a>';
621 $view->assignMultiple([
622 'title' => $this->pageinfo[
'title'],
623 'message' => sprintf($lang->getLL(
'pageIsExternalLinkMessage'), $externalUrlHtml),
631 if ($this->pageinfo[
'content_from_pid']) {
635 $link =
'<a href="' . htmlspecialchars($linkToPid) .
'">' . htmlspecialchars($title) .
' (PID ' . (int)$this->pageinfo[
'content_from_pid'] .
')</a>';
636 $message = sprintf($lang->getLL(
'content_from_pid_title'), $link);
637 $view->assignMultiple([
639 'message' => $message,
645 if (!empty($links)) {
646 $message = sprintf($lang->getLL(
'content_on_pid_title'), $links);
647 $view->assignMultiple([
649 'message' => $message,
666 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'pages');
667 $queryBuilder->getRestrictions()->removeAll();
668 $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
672 ->where($queryBuilder->expr()->eq(
'content_from_pid', $queryBuilder->createNamedParameter($pageId, \PDO::PARAM_INT)));
675 $rows = $queryBuilder->execute()->fetchAll();
677 foreach ($rows as $row) {
680 $link =
'<a href="' . htmlspecialchars($linkToPid) .
'">' . htmlspecialchars($title) .
' (PID ' . (int)$row[
'uid'] .
')</a>';
684 return implode(
', ', $links);
692 if ($this->current_sys_language > 0) {
693 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
694 ->getQueryBuilderForTable(
'pages');
695 $queryBuilder->getRestrictions()
697 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
698 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
699 $localizedPage = $queryBuilder
703 $queryBuilder->expr()->eq(
704 $GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'transOrigPointerField'],
705 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
707 $queryBuilder->expr()->eq(
708 $GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField'],
709 $queryBuilder->createNamedParameter($this->current_sys_language, \PDO::PARAM_INT)
716 return $localizedPage[
'title'];
718 return $this->pageinfo[
'title'];
727 protected function main(ServerRequestInterface $request =
null): void
729 $request = $request ?:
$GLOBALS[
'TYPO3_REQUEST'];
733 $access = is_array($this->pageinfo);
736 if ($this->
id && $access) {
741 $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
743 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
745 $this->moduleTemplate->addJavaScriptCode(
'mainJsFunctions',
'
747 top.fsMod.recentIds["web"] = ' . (
int)$this->
id .
';
748 top.fsMod.navFrameHighlightedID["web"] = top.fsMod.currentBank + "_" + ' . (
int)$this->
id .
';
751 function deleteRecord(table,id,url) { //
752 window.location.href = ' . GeneralUtility::quoteJSvalue((
string)$uriBuilder->buildUriFromRoute(
'tce_db') .
'&cmd[')
753 .
' + table + "][" + id + "][delete]=1&redirect=" + encodeURIComponent(url);
759 $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class .
'->getSelectedBackendLayout', $this->
id, $this);
760 if (!empty($backendLayout[
'__colPosList'])) {
761 $this->colPosList = implode(
',', $backendLayout[
'__colPosList']);
764 $this->colPosList = array_unique(GeneralUtility::intExplode(
',', $this->colPosList));
766 if (isset($this->modSharedTSconfig[
'properties'][
'colPos_list']) && trim($this->modSharedTSconfig[
'properties'][
'colPos_list']) !==
'') {
767 $this->activeColPosList = array_unique(GeneralUtility::intExplode(
',', trim($this->modSharedTSconfig[
'properties'][
'colPos_list'])));
769 if (!empty($this->colPosList) && !empty($this->activeColPosList)) {
770 $this->activeColPosList = array_unique(array_intersect(
771 $this->activeColPosList,
778 $this->activeColPosList = implode(
',', $this->activeColPosList);
779 $this->colPosList = implode(
',', $this->colPosList);
784 if ($this->MOD_SETTINGS[
'function'] == 1 || $this->MOD_SETTINGS[
'function'] == 2) {
785 $content .=
'<form action="' . htmlspecialchars((
string)$uriBuilder->buildUriFromRoute($this->moduleName, [
'id' => $this->id,
'imagemode' => $this->imagemode])) .
'" id="PageLayoutController" method="post">';
791 $content .=
'</form>';
799 $this->moduleTemplate->addJavaScriptCode(
801 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (
int)$this->
id .
';'
803 $content .=
'<h1>' . htmlspecialchars(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename']) .
'</h1>';
804 $view = GeneralUtility::makeInstance(StandaloneView::class);
805 $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
'EXT:backend/Resources/Private/Templates/InfoBox.html'));
806 $view->assignMultiple([
807 'title' => $lang->getLL(
'clickAPage_header'),
808 'message' => $lang->getLL(
'clickAPage_content'),
814 $this->moduleTemplate->setContent(
$content);
824 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
826 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ContextMenu');
827 $dbList = GeneralUtility::makeInstance(PageLayoutView::class);
829 $dbList->no_noWrap = 1;
832 $dbList->script = (string)$uriBuilder->buildUriFromRoute($this->moduleName);
833 $dbList->showIcon = 0;
834 $dbList->setLMargin = 0;
837 $dbList->agePrefixes = $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears');
840 $dbList->option_newWizard = empty($this->modTSconfig[
'properties'][
'disableNewContentElementWizard']);
841 $dbList->defLangBinding = !empty($this->modTSconfig[
'properties'][
'defLangBinding']);
842 if (!$dbList->nextThree) {
843 $dbList->nextThree = 1;
847 $dbList->getTableMenu($this->
id);
854 foreach ($dbList->activeTables as $table => $value) {
857 if (!isset($dbList->externalTables[$table])) {
859 $dbList->tt_contentConfig[
'showCommands'] = 1;
861 $dbList->tt_contentConfig[
'showInfo'] = 1;
863 if (is_array(
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][
'colPos'][
'config'][
'items'])) {
865 $tcaItems = GeneralUtility::callUserFunction(BackendLayoutView::class .
'->getColPosListItemsParsed', $this->
id, $this);
866 foreach ($tcaItems as $temp) {
867 $colList[] = $temp[1];
871 $colList = [
'1',
'0',
'2',
'3'];
873 if ($this->colPosList !==
'') {
874 $colList = array_intersect(GeneralUtility::intExplode(
',', $this->colPosList), $colList);
877 $dbList->tt_contentConfig[
'cols'] = implode(
',', $colList);
879 $dbList->tt_contentConfig[
'showHidden'] = $this->MOD_SETTINGS[
'tt_content_showHidden'];
880 $dbList->tt_contentConfig[
'sys_language_uid'] = (int)$this->current_sys_language;
882 if ($this->MOD_SETTINGS[
'function'] == 2) {
883 $dbList->tt_contentConfig[
'languageMode'] = 1;
884 $dbList->tt_contentConfig[
'languageCols'] = $this->MOD_MENU[
'language'];
889 if ($numberOfHiddenElements > 0) {
891 <div class="checkbox">
892 <label for="checkTt_content_showHidden">
893 <input type="checkbox" id="checkTt_content_showHidden" class="checkbox" name="SET[tt_content_showHidden]" value="1" ' . ($this->MOD_SETTINGS[
'tt_content_showHidden'] ?
'checked="checked"' :
'') .
' />
894 ' . htmlspecialchars($this->
getLanguageService()->
getLL(
'hiddenCE')) .
' (<span class="t3js-hidden-counter">' . $numberOfHiddenElements .
'</span>)
899 if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
904 $dbList->itemsLimitSingleTable = 1000;
905 $dbList->start($this->
id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
906 $dbList->counter = $CMcounter;
907 $dbList->ext_function = $this->MOD_SETTINGS[
'function'];
909 $dbList->generateList();
911 $tableOutput[$table] = $h_func . $dbList->HTMLcode . $h_func_b;
913 $tableJSOutput[$table] = $dbList->JScode;
915 $CMcounter += $dbList->counter;
917 $dbList->HTMLcode =
'';
918 $dbList->JScode =
'';
925 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'cms/layout/db_layout.php'][
'drawHeaderHook'] ?? [] as $hook) {
927 $content .= GeneralUtility::callUserFunction($hook, $params, $this);
930 foreach ($tableOutput as $table =>
$output) {
934 if (!$this->modTSconfig[
'properties'][
'disableSearchBox'] && ($dbList->counter > 0 || $this->currentPageHasSubPages())) {
936 $toggleSearchFormButton = $this->buttonBar->makeLinkButton()
937 ->setClasses(
't3js-toggle-search-toolbox')
938 ->setTitle($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.title.searchIcon'))
942 $this->searchContent = $dbList->getSearchBox();
945 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'cms/layout/db_layout.php'][
'drawFooterHook'] ?? [] as $hook) {
947 $content .= GeneralUtility::callUserFunction($hook, $params, $this);
969 protected function makeButtons(ServerRequestInterface $request): void
971 if ($this->MOD_SETTINGS[
'function'] == 1 || $this->MOD_SETTINGS[
'function'] == 2) {
973 $contextSensitiveHelpButton = $this->buttonBar->makeHelpButton()
974 ->setModuleName($this->descrTable)
975 ->setFieldName(
'columns_' . $this->MOD_SETTINGS[
'function']);
976 $this->buttonBar->addButton($contextSensitiveHelpButton);
988 if (isset($pageTsConfig[
'TCEMAIN.'][
'preview.'][
'disableButtonForDokType'])) {
989 $excludeDokTypes = GeneralUtility::intExplode(
991 $pageTsConfig[
'TCEMAIN.'][
'preview.'][
'disableButtonForDokType'],
997 !in_array((
int)$this->pageinfo[
'doktype'], $excludeDokTypes,
true)
1002 $this->pageinfo[
'uid'],
1009 $viewButton = $this->buttonBar->makeLinkButton()
1010 ->setOnClick($onClick)
1011 ->setTitle($lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage'))
1018 $shortcutButton = $this->buttonBar->makeShortcutButton()
1019 ->setModuleName($this->moduleName)
1030 ->setSetVariables(array_keys($this->MOD_MENU));
1031 $this->buttonBar->addButton($shortcutButton);
1033 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
1035 if (empty($this->modTSconfig[
'properties'][
'disableAdvanced'])) {
1036 $clearCacheButton = $this->buttonBar->makeLinkButton()
1037 ->setHref((
string)$uriBuilder->buildUriFromRoute($this->moduleName, [
'id' => $this->pageinfo[
'uid'],
'clear_cache' =>
'1']))
1038 ->setTitle($lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.clear_cache'))
1039 ->setIcon($this->iconFactory->getIcon(
'actions-system-cache-clear',
Icon::SIZE_SMALL));
1042 if (empty($this->modTSconfig[
'properties'][
'disableIconToolbar'])) {
1046 $normalizedParams = $request->getAttribute(
'normalizedParams');
1048 if ($this->MOD_SETTINGS[
'function'] == 1 && $this->current_sys_language > 0) {
1049 $localizationParentField =
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'transOrigPointerField'];
1050 $languageField =
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField'];
1051 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1052 ->getQueryBuilderForTable(
'pages');
1053 $queryBuilder->getRestrictions()
1055 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
1056 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
1057 $overlayRecord = $queryBuilder
1061 $queryBuilder->expr()->eq(
1062 $localizationParentField,
1063 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
1065 $queryBuilder->expr()->eq(
1067 $queryBuilder->createNamedParameter($this->current_sys_language, \PDO::PARAM_INT)
1077 $overlayRecord[
'uid'] =>
'edit'
1080 'returnUrl' => $normalizedParams->getRequestUri(),
1083 $url = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $urlParameters);
1084 $editLanguageButton = $this->buttonBar->makeLinkButton()
1086 ->setTitle($lang->getLL(
'editPageLanguageOverlayProperties'))
1087 ->setIcon($this->iconFactory->getIcon(
'mimetypes-x-content-page-language-overlay',
Icon::SIZE_SMALL));
1096 'returnUrl' => $normalizedParams->getRequestUri(),
1098 $url = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $urlParameters);
1099 $editPageButton = $this->buttonBar->makeLinkButton()
1101 ->setTitle($lang->getLL(
'editPageProperties'))
1122 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'tt_content');
1123 $queryBuilder->getRestrictions()
1125 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
1126 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
1130 ->from(
'tt_content')
1132 $queryBuilder->expr()->eq(
1134 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
1138 if (!empty($contentConfig[
'languageCols']) && is_array($contentConfig[
'languageCols'])) {
1140 if ($this->current_sys_language > 0) {
1141 $queryBuilder->andWhere(
1142 $queryBuilder->expr()->in(
1144 [0, $queryBuilder->createNamedParameter($this->current_sys_language, \PDO::PARAM_INT)]
1149 $queryBuilder->andWhere(
1150 $queryBuilder->expr()->eq(
1152 $queryBuilder->createNamedParameter($this->current_sys_language, \PDO::PARAM_INT)
1157 if (!empty(
$GLOBALS[
'TCA'][
'tt_content'][
'ctrl'][
'enablecolumns'][
'disabled'])) {
1158 $andWhere[] = $queryBuilder->expr()->neq(
1160 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
1164 if (!empty(
$GLOBALS[
'TCA'][
'tt_content'][
'ctrl'][
'enablecolumns'][
'starttime'])) {
1165 $andWhere[] = $queryBuilder->expr()->andX(
1166 $queryBuilder->expr()->neq(
1168 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
1170 $queryBuilder->expr()->gt(
1172 $queryBuilder->createNamedParameter(
$GLOBALS[
'SIM_ACCESS_TIME'], \PDO::PARAM_INT)
1177 if (!empty(
$GLOBALS[
'TCA'][
'tt_content'][
'ctrl'][
'enablecolumns'][
'endtime'])) {
1178 $andWhere[] = $queryBuilder->expr()->andX(
1179 $queryBuilder->expr()->neq(
1181 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
1183 $queryBuilder->expr()->lte(
1185 $queryBuilder->createNamedParameter(
$GLOBALS[
'SIM_ACCESS_TIME'], \PDO::PARAM_INT)
1190 if (!empty($andWhere)) {
1191 $queryBuilder->andWhere(
1192 $queryBuilder->expr()->orX(...$andWhere)
1196 $count = $queryBuilder
1212 $params[
'popView'] =
'';
1213 $params[
'new_unique_uid'] =
'';
1214 return GeneralUtility::linkThisScript($params);
1229 return !$this->pageinfo[
'editlock']
1259 return !$this->pageinfo[
'editlock']
1304 return GeneralUtility::makeInstance(PageRenderer::class);
1312 if (count($this->MOD_MENU[
'language']) > 1) {
1313 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
1314 $languageMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
1315 $languageMenu->setIdentifier(
'languageMenu');
1316 foreach ($this->MOD_MENU[
'language'] as $key => $language) {
1317 $menuItem = $languageMenu
1319 ->setTitle($language)
1320 ->setHref((
string)$uriBuilder->buildUriFromRoute($this->moduleName) .
'&id=' . $this->id .
'&SET[language]=' . $key);
1321 if ((
int)$this->current_sys_language === $key) {
1322 $menuItem->setActive(
true);
1324 $languageMenu->addMenuItem($menuItem);
1326 $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($languageMenu);
1338 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'pages');
1339 $queryBuilder->getRestrictions()
1341 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
1342 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
1346 $comparisonExpression = $workspaceId === 0 ?
'neq' :
'eq';
1348 $count = $queryBuilder
1352 $queryBuilder->expr()->eq(
'pid', $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)),
1353 $queryBuilder->expr()->eq(
1355 $queryBuilder->createNamedParameter($workspaceId, \PDO::PARAM_INT)
1357 $queryBuilder->expr()->{$comparisonExpression}(
1359 $queryBuilder->createNamedParameter(-1, \PDO::PARAM_INT)
1365 return (
bool)$count;
1375 protected function getTargetPageIfVisible(array $targetPage): array
1377 return !(bool)($targetPage[
'hidden'] ??
false) ? $targetPage : [];