Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions Classes/Controller/AbstractBackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ abstract class AbstractBackendController extends ActionController implements Bac

protected array $viewDropdownButtons = [];

protected ?int $fullRecordCount = null;

protected ConnectionPool $connectionPool;

protected IconFactory $iconFactory;
Expand Down Expand Up @@ -674,8 +676,12 @@ protected function isDirectPublishingAllowed(): bool
*/
protected function getFullRecordCount(): int
{
if ($this->fullRecordCount !== null) {
return $this->fullRecordCount;
}

if ($this->getRequestedPids() === []) {
return 0;
return $this->fullRecordCount = 0;
}

$tableName = $this->getTableName();
Expand All @@ -691,7 +697,7 @@ protected function getFullRecordCount(): int
->executeQuery()
->fetchNumeric();

return $count ? $count[0] : 0;
return $this->fullRecordCount = ($count ? $count[0] : 0);
}

protected function getRequestedPids(): array
Expand Down Expand Up @@ -2182,6 +2188,11 @@ protected function addResetViewButtonToViewDropdown(): void

protected function addDownloadButtonToModuleTemplate(): void
{
// With no records at all the export would be empty; skip the button.
if ($this->getFullRecordCount() === 0) {
return;
}

if (!$this->isActionAllowedInCurrentTemplate('download')) {
return;
}
Expand Down Expand Up @@ -2238,6 +2249,11 @@ protected function getActiveFilterCount(): int

protected function addToggleFiltersButtonToNewModuleTemplate(): void
{
// With no records at all there is nothing to filter; skip the button.
if ($this->getFullRecordCount() === 0) {
return;
}

if (!$this->isActionAllowedInCurrentTemplate('toggleFilters')) {
return;
}
Expand Down Expand Up @@ -2498,6 +2514,11 @@ protected function assignViewVariables(): void

protected function addViewDropdownButtonToModuleTemplate(): void
{
// With no records at all there is no table to configure; skip the button.
if ($this->getFullRecordCount() === 0) {
return;
}

if (empty($this->viewDropdownButtons)) {
return;
}
Expand Down
Loading