Skip to content

Commit

Permalink
Merge pull request #218 from sdelcroix/fix-217
Browse files Browse the repository at this point in the history
[BUGFIX] Fix Exception: in Hooks\AbstractBeButtons::generateButtons() if _GP('id') is null
  • Loading branch information
joey-bolts authored Sep 18, 2023
2 parents 572dd5c + b9e9df0 commit 94bee1f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Classes/Hooks/DocHeaderButtonsHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace BeechIt\FalSecuredownload\Hooks;

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
Expand Down Expand Up @@ -62,7 +63,10 @@ public function getButtons(array $params, ButtonBar $buttonBar): array
{
$buttons = $params['buttons'];

foreach ($this->generateButtons(GeneralUtility::_GP('id')) as $buttonInfo) {
$identifier = $this->getRequest()->getQueryParams()['id'] ?? null;
if(is_null($identifier)) return $buttons;

foreach ($this->generateButtons($identifier) as $buttonInfo) {
$button = $buttonBar->makeLinkButton();
$button->setIcon($buttonInfo['icon']);
$button->setTitle($buttonInfo['title']);
Expand All @@ -72,4 +76,12 @@ public function getButtons(array $params, ButtonBar $buttonBar): array

return $buttons;
}

/**
* Get Request
*/
private function getRequest(): ServerRequestInterface
{
return $GLOBALS['TYPO3_REQUEST'];
}
}

0 comments on commit 94bee1f

Please sign in to comment.