Project

General

Profile

Actions

Bug #102922

closed

Memory limit php error when trying to add a button with addButton() in an event listener

Added by TimoF no-lastname-given 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-01-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When I try to add a button in an event listener, I get a php memory limit error.
I am using this one: https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/Events/Events/Backend/ModifyButtonBarEvent.html
This is the code. Everything is working till the line with addButton().

        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
        $buttonBar = $event->getButtonBar();
        $button = $buttonBar
            ->makeLinkButton()
            ->setHref('#')
            ->setTitle('TEST')
            ->setIcon($iconFactory->getIcon('actions-approve', Icon::SIZE_SMALL))
            ->setShowLabelText(true)
        ;
        $buttonBar->addButton($button, ButtonBar::BUTTON_POSITION_LEFT, 1);
        $event->setButtons($buttonBar->getButtons());
Actions

Also available in: Atom PDF