Commit e4d3e3bc authored by Eric Chavaillaz's avatar Eric Chavaillaz Committed by Benni Mack
Browse files

[BUGFIX] Respect mod.web_list.noViewWithDokTypes also in record list

The option noViewWithDokTypes is now also respected for
the control panel of a single record in the listing.

Resolves: #92813
Releases: master, 10.4
Change-Id: Ie6ba12bf5dd22039aee28e05585b3d3930b3faeb
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66597

Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 5ddb8ebd
......@@ -495,17 +495,6 @@ class DatabaseRecordList
->setFieldName($fieldName);
$buttonBar->addButton($cshButton);
if (isset($this->id)) {
// View Exclude doktypes 254,255 Configuration:
// mod.web_list.noViewWithDokTypes = 254,255
if (isset($modulePageTsConfig['noViewWithDokTypes'])) {
$noViewDokTypes = GeneralUtility::trimExplode(',', $modulePageTsConfig['noViewWithDokTypes'], true);
} else {
//default exclusion: doktype 254 (folder), 255 (recycler)
$noViewDokTypes = [
PageRepository::DOKTYPE_SYSFOLDER,
PageRepository::DOKTYPE_RECYCLER
];
}
// New record on pages that are not locked by editlock
if (!($modulePageTsConfig['noCreateRecordsLink'] ?? false) && $this->editLockPermissions()) {
$newRecordButton = $buttonBar->makeLinkButton()
......@@ -514,7 +503,7 @@ class DatabaseRecordList
->setIcon($this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL));
$buttonBar->addButton($newRecordButton, ButtonBar::BUTTON_POSITION_LEFT, 10);
}
if (!in_array($this->pageRow['doktype'] ?? null, $noViewDokTypes)) {
if (!in_array($this->pageRow['doktype'] ?? null, $this->getNoViewWithDokTypes($modulePageTsConfig))) {
$previewDataAttributes = PreviewUriBuilder::create((int)$this->id)
->withRootLine(BackendUtility::BEgetRootLine($this->id))
->buildDispatcherDataAttributes();
......@@ -1685,7 +1674,11 @@ class DatabaseRecordList
$permsEdit = $this->overlayEditLockPermissions($table, $row, $permsEdit);
// "Show" link (only pages and tt_content elements)
if ($table === 'pages' || $table === 'tt_content') {
$tsConfig = BackendUtility::getPagesTSconfig($this->id)['mod.']['web_list.'] ?? [];
if (
($table === 'pages' && !in_array($row['doktype'] ?? null, $this->getNoViewWithDokTypes($tsConfig)))
|| $table === 'tt_content'
) {
if (!$isDeletePlaceHolder) {
$attributes = $this->getPreviewUriBuilder($table, $row)->serializeDispatcherAttributes();
$viewAction = '<a class="btn btn-default" href="#" ' . $attributes
......@@ -1700,6 +1693,8 @@ class DatabaseRecordList
} else {
$this->addActionToCellGroup($cells, $this->spaceIcon, 'view');
}
} else {
$this->addActionToCellGroup($cells, $this->spaceIcon, 'view');
}
// "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
......@@ -3702,4 +3697,25 @@ class DatabaseRecordList
$this->id
));
}
/**
* Returns the configuration of mod.web_list.noViewWithDokTypes or the
* default value 254 (Sys Folders) and 255 (Recycler), if not set.
*
* @param array $tsConfig
* @return array
*/
protected function getNoViewWithDokTypes(array $tsConfig): array
{
if (isset($tsConfig['noViewWithDokTypes'])) {
$noViewDokTypes = GeneralUtility::trimExplode(',', $tsConfig['noViewWithDokTypes'], true);
} else {
$noViewDokTypes = [
PageRepository::DOKTYPE_SYSFOLDER,
PageRepository::DOKTYPE_RECYCLER
];
}
return $noViewDokTypes;
}
}
Markdown is supported
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