diff --git a/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/PageProvider.php b/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/PageProvider.php index fad1fde5b50d4db1be683e8f70c318cd4017a650..914f185de20b45e0517260bc29039c68c5db111d 100644 --- a/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/PageProvider.php +++ b/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/PageProvider.php @@ -423,7 +423,8 @@ class PageProvider extends RecordProvider { return !$this->isRoot() && !$this->isDeleted() - && !$this->isExcludedDoktype(); + && !$this->isExcludedDoktype() + && $this->previewLinkCanBeBuild(); } /** diff --git a/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php b/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php index 2f209d24d0713f68be067371dd813b36c61828d5..4431a7bd8629b9e18ac5b7ef4a1381de85cba1f6 100644 --- a/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php +++ b/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php @@ -442,7 +442,9 @@ class RecordProvider extends AbstractProvider */ protected function canBeViewed(): bool { - return $this->table === 'tt_content' && $this->parentPageCanBeViewed(); + return $this->table === 'tt_content' + && $this->parentPageCanBeViewed() + && $this->previewLinkCanBeBuild(); } /** @@ -643,4 +645,12 @@ class RecordProvider extends AbstractProvider { return $this->record['uid']; } + + /** + * Returns true if a view link can be build for the record + */ + protected function previewLinkCanBeBuild(): bool + { + return $this->getViewLink() !== ''; + } } diff --git a/typo3/sysext/backend/Classes/Controller/NewRecordController.php b/typo3/sysext/backend/Classes/Controller/NewRecordController.php index cd835ad1596fbc3ada43847df6be3bbcd3687cc5..2025c5a7d42a3d095877b944790833e9ba71a1f8 100644 --- a/typo3/sysext/backend/Classes/Controller/NewRecordController.php +++ b/typo3/sysext/backend/Classes/Controller/NewRecordController.php @@ -319,12 +319,10 @@ class NewRecordController $viewButton = $buttonBar->makeLinkButton() ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) - ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setShowLabelText(true) - ->setIcon($this->iconFactory->getIcon( - 'actions-view-page', - Icon::SIZE_SMALL - )); + ->setDisabled(!$previewDataAttributes) + ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) + ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) + ->setShowLabelText(true); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 30); } } diff --git a/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php b/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php index 80801c94a2101573c10d55d923515a1426edde92..8c2cb16c6dc3a7eb7d99965fa8ba21ca7e023acf 100644 --- a/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php +++ b/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php @@ -74,11 +74,12 @@ class NewMultiplePagesController ->withRootLine(BackendUtility::BEgetRootLine($pageUid)) ->buildDispatcherDataAttributes(); $viewButton = $buttonBar->makeLinkButton() + ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) + ->setDisabled(!$previewDataAttributes) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setShowLabelText(true) ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) - ->setHref('#'); + ->setShowLabelText(true); $buttonBar->addButton($viewButton); $calculatedPermissions = new Permission($backendUser->calcPerms($pageRecord)); diff --git a/typo3/sysext/backend/Classes/Controller/Page/SortSubPagesController.php b/typo3/sysext/backend/Classes/Controller/Page/SortSubPagesController.php index 20718aa3910c7a66ccfa40bddf9ea36e4e85f345..a7a9e20903a93058019b6012aa5123bd8212b648 100644 --- a/typo3/sysext/backend/Classes/Controller/Page/SortSubPagesController.php +++ b/typo3/sysext/backend/Classes/Controller/Page/SortSubPagesController.php @@ -70,11 +70,12 @@ class SortSubPagesController ->withRootLine(BackendUtility::BEgetRootLine($parentPageUid)) ->buildDispatcherDataAttributes(); $viewButton = $buttonBar->makeLinkButton() + ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) + ->setDisabled(!$previewDataAttributes) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setShowLabelText(true) ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) - ->setHref('#'); + ->setShowLabelText(true); $buttonBar->addButton($viewButton); $isInWorkspace = $backendUser->workspace !== 0; diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index 9b2ee323ef3c4d2452c84d2c1c212edbcfd6a5a9..85fecaf87207aadb8e64376663f36e7a0737b574 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -632,11 +632,12 @@ class PageLayoutController ->buildDispatcherDataAttributes(); return $buttonBar->makeLinkButton() + ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) + ->setDisabled(!$previewDataAttributes) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) - ->setShowLabelText(true) - ->setHref('#'); + ->setShowLabelText(true); } /** diff --git a/typo3/sysext/backend/Classes/Controller/RecordListController.php b/typo3/sysext/backend/Classes/Controller/RecordListController.php index 5b66e5f4723546ad9e8731826cbcc7263625e2de..6e05c95255f2ab16fa5d6a9c8e99ffdb68bb8671 100644 --- a/typo3/sysext/backend/Classes/Controller/RecordListController.php +++ b/typo3/sysext/backend/Classes/Controller/RecordListController.php @@ -310,9 +310,10 @@ class RecordListController $viewButton = $buttonBar->makeLinkButton() ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) - ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setShowLabelText(true) - ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)); + ->setDisabled(!$previewDataAttributes) + ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) + ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) + ->setShowLabelText(true); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 15); } // If edit permissions are set, see BackendUserAuthentication diff --git a/typo3/sysext/backend/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/backend/Classes/RecordList/DatabaseRecordList.php index 171d2b21825083167ea1fccfee202e16b6858da1..893dc86424c920ff0a0eba0ae4b310477be438cb 100644 --- a/typo3/sysext/backend/Classes/RecordList/DatabaseRecordList.php +++ b/typo3/sysext/backend/Classes/RecordList/DatabaseRecordList.php @@ -1371,9 +1371,10 @@ class DatabaseRecordList && !in_array((int)$this->pageRow['doktype'], $this->getNoViewWithDokTypes($tsConfig), true) ) ) { - if (!$isDeletePlaceHolder) { - $attributes = $this->getPreviewUriBuilder($table, $row)->serializeDispatcherAttributes(); - $viewAction = '<a href="#"' + if (!$isDeletePlaceHolder + && ($attributes = $this->getPreviewUriBuilder($table, $row)->serializeDispatcherAttributes()) !== null + ) { + $viewAction = '<button' . ' class="btn btn-default" ' . $attributes . ' title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) . '">'; if ($table === 'pages') { @@ -1381,7 +1382,7 @@ class DatabaseRecordList } else { $viewAction .= $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render(); } - $viewAction .= '</a>'; + $viewAction .= '</button>'; $this->addActionToCellGroup($cells, $viewAction, 'view'); } else { $this->addActionToCellGroup($cells, $this->spaceIcon, 'view'); @@ -2576,13 +2577,14 @@ class DatabaseRecordList break; case 'show': // "Show" link (only pages and tt_content elements) - if ($table === 'pages' || $table === 'tt_content') { - $attributes = $this->getPreviewUriBuilder($table, $row)->serializeDispatcherAttributes(); + if (($table === 'pages' || $table === 'tt_content') + && ($attributes = $this->getPreviewUriBuilder($table, $row)->serializeDispatcherAttributes()) !== null + ) { $title = htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')); - $code = '<a href="#" ' . $attributes + $code = '<button ' . $attributes . ' title="' . $title . '"' . ' aria-label="' . $title . '">' - . $code . '</a>'; + . $code . '</button>'; } break; case 'info': diff --git a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/LanguageColumns.html b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/LanguageColumns.html index e1ebf51f6f526fb3141eb16179c71458ccace578..5aa2aa11d4d72cd4b49e17325685251c869bfb45 100644 --- a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/LanguageColumns.html +++ b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/LanguageColumns.html @@ -32,9 +32,9 @@ <td class="t3-page-column t3-page-lang-label nowrap"> <div class="btn-group"> <f:if condition="{languageColumn.allowViewPage}"> - <a href="#" class="btn btn-default btn-sm" {languageColumn.previewUrlAttributes -> f:format.raw()} title="{languageColumn.viewPageLinkTitle}"> + <button class="btn btn-default btn-sm" {f:if(condition: languageColumn.previewUrlAttributes, then: '{languageColumn.previewUrlAttributes -> f:format.raw()}', else: 'disabled="true"')} title="{languageColumn.viewPageLinkTitle}"> <core:icon identifier="actions-view" /> - </a> + </button> </f:if> <f:if condition="{languageColumn.allowEditPage}"> <a href="{languageColumn.pageEditUrl}" class="btn btn-default btn-sm" title="{languageColumn.pageEditTitle}"> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html b/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html index 982c55c4f237020e220c3ab7d8758db9b0c271fb..399ece5daf16800450f208bc43b5c79bc5aa0a86 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html @@ -234,9 +234,9 @@ <f:section name="action"> <div class="btn-group" role="group"> <f:if condition="{line.webListUrl}"> - <a class="btn btn-default btn-sm" href="#" {line.previewUrlAttributes -> f:format.raw()} title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')}"> + <button class="btn btn-default btn-sm" {f:if(condition: languageColumn.previewUrlAttributes, then: '{languageColumn.previewUrlAttributes -> f:format.raw()}', else: 'disabled="true"')} title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')}"> <core:icon identifier="actions-document-view" size="small" /> - </a> + </button> </f:if> <a class="btn btn-default btn-sm" href="{line.recordEditUrl}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.edit')}"> <core:icon identifier="actions-open" size="small" /> diff --git a/typo3/sysext/impexp/Classes/Controller/ImportController.php b/typo3/sysext/impexp/Classes/Controller/ImportController.php index 5b09b139e6eba86d9e01d5b249db5309b1d4dbdc..17b56939bacf375f587c7e5525cfcdd669d71e9a 100644 --- a/typo3/sysext/impexp/Classes/Controller/ImportController.php +++ b/typo3/sysext/impexp/Classes/Controller/ImportController.php @@ -137,11 +137,12 @@ class ImportController ->withRootLine(BackendUtility::BEgetRootLine($pageUid)) ->buildDispatcherDataAttributes(); $viewButton = $buttonBar->makeLinkButton() - ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setShowLabelText(true) ->setHref('#') + ->setDataAttributes($previewDataAttributes ?? []) + ->setDisabled(!$previewDataAttributes) + ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) - ->setDataAttributes($previewDataAttributes ?? []); + ->setShowLabelText(true); $buttonBar->addButton($viewButton); } diff --git a/typo3/sysext/impexp/Classes/ImportExport.php b/typo3/sysext/impexp/Classes/ImportExport.php index cbbbbc3ccf425454ea08a784d5147073ea2d6025..bdf78caddad009f0d00de8496d1c8ebfd6e5d2a4 100644 --- a/typo3/sysext/impexp/Classes/ImportExport.php +++ b/typo3/sysext/impexp/Classes/ImportExport.php @@ -542,7 +542,9 @@ abstract class ImportExport $viewID = $this->mode === 'export' ? $uid : ($this->doesImport ? ($this->importMapId['pages'][$uid] ?? 0) : 0); if ($viewID) { $attributes = PreviewUriBuilder::create($viewID)->serializeDispatcherAttributes(); - $line['title'] = sprintf('<a href="#" %s>%s</a>', $attributes, $line['title']); + if ($attributes) { + $line['title'] = sprintf('<a href="#" %s>%s</a>', $attributes, $line['title']); + } } } $line['active'] = !$this->isRecordDisabled($table, $uid) ? 'active' : 'hidden'; diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecords.php b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecords.php index 790e24a829ae40c56cfb2c13a6239582d9ee4a07..96536fe53f616549c6380e994d98ed4a1590646c 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecords.php +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecords.php @@ -186,7 +186,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Root</a>', + 'title' => 'Root', 'active' => 'active', 'controls' => '<div class="form-check mb-0"><input class="form-check-input t3js-exclude-checkbox" type="checkbox" name="tx_impexp[exclude][pages:1]" id="checkExcludepages:1" value="1" /><label class="form-check-label" for="checkExcludepages:1">Exclude</label></div>', 'message' => '', @@ -393,7 +393,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Dummy 1-2</a>', + 'title' => 'Dummy 1-2', 'active' => 'active', 'controls' => '<div class="form-check mb-0"><input class="form-check-input t3js-exclude-checkbox" type="checkbox" name="tx_impexp[exclude][pages:2]" id="checkExcludepages:2" value="1" /><label class="form-check-label" for="checkExcludepages:2">Exclude</label></div>', 'message' => '', @@ -409,7 +409,7 @@ return [ </span> <span class="icon-overlay icon-overlay-hidden"><svg class="icon-color"><use xlink:href="typo3/sysext/core/Resources/Public/Icons/T3Icons/sprites/overlay.svg#overlay-hidden" /></svg></span> </span>', - 'title' => '<a href="#" >Dummy 1-3</a>', + 'title' => 'Dummy 1-3', 'active' => 'hidden', 'controls' => '<div class="form-check mb-0"><input class="form-check-input t3js-exclude-checkbox" type="checkbox" name="tx_impexp[exclude][pages:3]" id="checkExcludepages:3" value="1" /><label class="form-check-label" for="checkExcludepages:3">Exclude</label></div>', 'message' => '', diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecordsWithSoftRefs.php b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecordsWithSoftRefs.php index 2a96fb125ec8c2293054eefc995f12b94306e648..b0b8fd9666e3093fff0e00f5cad88ebe4860ead3 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecordsWithSoftRefs.php +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecordsWithSoftRefs.php @@ -170,7 +170,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Root</a>', + 'title' => 'Root', 'active' => 'active', 'controls' => '<div class="form-check mb-0"><input class="form-check-input t3js-exclude-checkbox" type="checkbox" name="tx_impexp[exclude][pages:1]" id="checkExcludepages:1" value="1" /><label class="form-check-label" for="checkExcludepages:1">Exclude</label></div>', 'message' => '', @@ -260,7 +260,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Dummy 1-2</a>', + 'title' => 'Dummy 1-2', 'active' => 'active', 'controls' => '<div class="form-check mb-0"><input class="form-check-input t3js-exclude-checkbox" type="checkbox" name="tx_impexp[exclude][pages:2]" id="checkExcludepages:2" value="1" /><label class="form-check-label" for="checkExcludepages:2">Exclude</label></div>', 'message' => '', @@ -276,7 +276,7 @@ return [ </span> <span class="icon-overlay icon-overlay-hidden"><svg class="icon-color"><use xlink:href="typo3/sysext/core/Resources/Public/Icons/T3Icons/sprites/overlay.svg#overlay-hidden" /></svg></span> </span>', - 'title' => '<a href="#" >Dummy 1-3</a>', + 'title' => 'Dummy 1-3', 'active' => 'hidden', 'controls' => '<div class="form-check mb-0"><input class="form-check-input t3js-exclude-checkbox" type="checkbox" name="tx_impexp[exclude][pages:3]" id="checkExcludepages:3" value="1" /><label class="form-check-label" for="checkExcludepages:3">Exclude</label></div>', 'message' => '', diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdate.php b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdate.php index 89123ff991b73ec463cdefa8fbfa48f24a91409f..e5bad259dd1642a956f32a516d48bd10766e690f 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdate.php +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdate.php @@ -29,7 +29,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Root</a>', + 'title' => 'Root', 'active' => 'active', 'updatePath' => '/', 'updateMode' => sprintf('<select class="form-select form-select-sm" name="tx_impexp[import_mode][pages:1]" style="width: 100px"><option value="0">Update</option><option value="%s">Import as new</option><option value="%s">Ignore PID</option><option value="%s">Exclude</option></select>', \TYPO3\CMS\Impexp\Import::IMPORT_MODE_AS_NEW, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_IGNORE_PID, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_EXCLUDE), @@ -169,7 +169,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Dummy 1-2</a>', + 'title' => 'Dummy 1-2', 'active' => 'active', 'updatePath' => '/Root/', 'updateMode' => sprintf('<select class="form-select form-select-sm" name="tx_impexp[import_mode][pages:2]" style="width: 100px"><option value="0">Update</option><option value="%s">Import as new</option><option value="%s">Ignore PID</option><option value="%s">Exclude</option></select>', \TYPO3\CMS\Impexp\Import::IMPORT_MODE_AS_NEW, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_IGNORE_PID, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_EXCLUDE), diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php index 95ae71a84ba00e1bcceb819b8b1ef4fffcf319aa..a18861f9ad53ba4dceeb961eebe9b52e9cf8a8d6 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php @@ -517,7 +517,7 @@ return [ . "\t" . '</span>' . "\n" . "\t\n" . '</span>', - 'title' => '<a href="#" >Root</a>', + 'title' => 'Root', 'active' => 'active', 'updatePath' => '/', 'updateMode' => sprintf('<select class="form-select form-select-sm" name="tx_impexp[import_mode][pages:1]" style="width: 100px"><option value="0">Update</option><option value="%s">Import as new</option><option value="%s">Ignore PID</option><option value="%s">Exclude</option></select>', \TYPO3\CMS\Impexp\Import::IMPORT_MODE_AS_NEW, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_IGNORE_PID, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_EXCLUDE), diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsWithDiff.php b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsWithDiff.php index d3ce6c98bad62a658132864b0156699e25dc6c1e..ef5944901a16728f22bea9680a2941e2f7bcdf8d 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsWithDiff.php +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsWithDiff.php @@ -470,7 +470,7 @@ return [ </span> </span>', - 'title' => '<a href="#" >Root</a>', + 'title' => 'Root', 'active' => 'active', 'showDiffContent' => '<strong class="text-nowrap">[pages:1 => 1]:</strong> Match', diff --git a/typo3/sysext/info/Classes/Controller/InfoModuleController.php b/typo3/sysext/info/Classes/Controller/InfoModuleController.php index b1c31aeada88da0cb2d9d398b0f542ca0a4223b1..b7d7578068b78d7dbec29f5085a6ecf4cb525c2f 100644 --- a/typo3/sysext/info/Classes/Controller/InfoModuleController.php +++ b/typo3/sysext/info/Classes/Controller/InfoModuleController.php @@ -147,9 +147,10 @@ class InfoModuleController $viewButton = $buttonBar->makeLinkButton() ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) - ->setShowLabelText(true) - ->setTitle($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)); + ->setDisabled(!$previewDataAttributes) + ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) + ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) + ->setShowLabelText(true); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT); } } diff --git a/typo3/sysext/info/Classes/Controller/PageInformationController.php b/typo3/sysext/info/Classes/Controller/PageInformationController.php index 222b17c27e3b8b4192a8a8a27cd85fc6ab79c55f..e62a4372574191df8ba48b3de536a4dbc3e4056a 100644 --- a/typo3/sysext/info/Classes/Controller/PageInformationController.php +++ b/typo3/sysext/info/Classes/Controller/PageInformationController.php @@ -375,10 +375,10 @@ class PageInformationController extends InfoModuleController ->withRootLine(BackendUtility::BEgetRootLine($row['uid'])) ->serializeDispatcherAttributes(); $editButton = - '<a href="#" ' . $attributes . ' class="btn btn-default" title="' . + '<button ' . ($attributes ?? 'disabled="true"') . ' class="btn btn-default" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) . '">' . $this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)->render() . - '</a>'; + '</button>'; if ($this->getBackendUser()->check('tables_modify', 'pages')) { $editButton .= diff --git a/typo3/sysext/info/Classes/Controller/TranslationStatusController.php b/typo3/sysext/info/Classes/Controller/TranslationStatusController.php index e01c2114d7589ad96bd4f6e0adf117aa0841e171..67db47dae0c70b8ae1b7cb48a1fbfa53b9cfefed 100644 --- a/typo3/sysext/info/Classes/Controller/TranslationStatusController.php +++ b/typo3/sysext/info/Classes/Controller/TranslationStatusController.php @@ -175,9 +175,9 @@ class TranslationStatusController extends InfoModuleController ], 'returnUrl' => $request->getAttribute('normalizedParams')->getRequestUri(), ]); - $info = '<a href="#" ' . $previewUriBuilder->serializeDispatcherAttributes() + $info = '<button ' . ($previewUriBuilder->serializeDispatcherAttributes() ?? 'disabled="true"') . ' class="btn btn-default" title="' . $lang->sL('LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_viewPage') . '">' . - $this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)->render() . '</a>'; + $this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)->render() . '</button>'; if ($backendUser->check('tables_modify', 'pages')) { $info .= '<a href="' . htmlspecialchars($editUrl) . '" class="btn btn-default" title="' . $lang->sL( @@ -241,11 +241,11 @@ class TranslationStatusController extends InfoModuleController 'returnUrl' => $request->getAttribute('normalizedParams')->getRequestUri(), ]); // ViewPageLink - $info = '<a href="#" ' . $previewUriBuilder + $info = '<button ' . ($previewUriBuilder ->withLanguage($languageId) - ->serializeDispatcherAttributes() + ->serializeDispatcherAttributes() ?? 'disabled="true"') . ' class="btn btn-default" title="' . $lang->sL('LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_viewPage') . '">' . - $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>'; + $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</button>'; $info .= '<a href="' . htmlspecialchars($editUrl) . '" class="btn btn-default" title="' . $lang->sL( 'LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_editLanguageOverlayRecord' diff --git a/typo3/sysext/tstemplate/Classes/Controller/AbstractTemplateModuleController.php b/typo3/sysext/tstemplate/Classes/Controller/AbstractTemplateModuleController.php index b74fc6cec277389f279c8d997051524fd40335b2..309aa6bdd4cc5001bacc8989a42b7caafac4f14b 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/AbstractTemplateModuleController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/AbstractTemplateModuleController.php @@ -141,9 +141,10 @@ abstract class AbstractTemplateModuleController $viewButton = $buttonBar->makeLinkButton() ->setHref('#') ->setDataAttributes($previewDataAttributes ?? []) - ->setTitle($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) - ->setShowLabelText(true) - ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)); + ->setDisabled(!$previewDataAttributes) + ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage')) + ->setIcon($this->iconFactory->getIcon('actions-view-page', Icon::SIZE_SMALL)) + ->setShowLabelText(true); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 99); } }