[TYPO3-dev] [SOLVED] 7.0.2: How to display flashMessages from the initialization phase of a controller

Thomas Hucke thucke at web.de
Tue Jan 13 21:06:14 CET 2015


Hi list,

I got a solution and I'd like you to know:

Just override the slotHandlerMethod of the ActionController in your own 
controller :

protected function emitBeforeCallActionMethodSignal(array 
$preparedArguments) {
  parent::emitBeforeCallActionMethodSignal($preparedArguments);
  ... put your code here .... e.g.
  $this->addFlashMessage( 'messageText', 'messageTitle', 
constant('\TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR'));
}

That's all of the magic having a fully initialized controller for executing 
code before any 'normal' action will be processed.


Take care
Thomas

"Thomas Hucke"  schrieb im Newsbeitrag 
news:mailman.1.1420996510.28966.typo3-dev at lists.typo3.org...

Hi,

in my controller I'm using initializeAction() method.
Now it could be that I'd configuration validation check being done there
would like to fire flashMessages to the FE.
Unfortunately the method addFlashMessage() throws an error (calling method
of a non-object).
The reason is that AbstractController uses
$this->controllerContext->getFlashMessageQueue() ... but
$this->controllerContext is not initialized when procession
initializeAction().

Now I've got the idea using the signalSlotHandler
'emitBeforeCallActionHandler' for adding the messages which brings me to the
next issue (see 'TYPO3 7.0.2: Cannot connect to signalSlot' in this list).
Does anybody have another idea how to add those flashMessages whithout
having to call a method in every actionHandler?

Thanks
Thomas 




More information about the TYPO3-dev mailing list