[TYPO3-core] RFC #11684: Add support for flash messages in the backend

Steffen Kamper info at sk-typo3.de
Wed Aug 19 11:05:29 CEST 2009


Hi Ingo,

Ingo Renner schrieb:
> Steffen Kamper wrote:
> 
> Hi Steffen,
> 
>> yes, i've seen it. I thought about one class holding more than one
>> message.
> 
> Nope, each instance represents a single message.
> 
>> Now each message is saved in session, what's the reason? (a bit
>> more background info about the concept would be fine)
> 
> That's to simply "store" them "somewhere". Sessions are a common place 
> to store flash messages as they're user bound, think of an "OK - News 
> entry successfully saved" message displayed to a user after saving a 
> news record.
>

i see, but that's needed as every message is a single object.
Having a class as singleton could hold all the messages in an array 
without need to store in a session, having methods like addMessage, 
renderMessage, renderAllMessages etc.
Saving in session only makes sense imho if you need them at later point.
You see what i mean?


>> Whats about a wrapper function doing this with one call?
> 
> to do what?
> 

following your example it would be something like:
$this->doc->addMessage(...) with

function addMessage($message, $title, $severity=-1) {
   $flashMessage = t3lib_div::makeInstance(
     't3lib_FlashMessage',
     $message, $title, $severity
   );
   $this->pushFlashMessage($flashMessage);
   return $flashMessage;
}

vg Steffen


More information about the TYPO3-team-core mailing list