Project

General

Profile

Bug #102922

Updated by Mathias Brodala 10 months ago

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()@. setButtons. 

 <pre><code class="php"> 
         $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()); 
 </code></pre> 

Back