Hi,

So being back to the drawing board on flash messages I would like to see the 
following things:
1) flash messages are a "key" plus an array with parameters. this is 
essentially the name/value pair we have atm in setFlash(). however there should 
be a third optional parameter to also pass a type. its either a string with an 
arbitrary value or an integer which maps to one of the default types provided 
as constants (notice, warning, error)
2) inside the templates there needs to be the following methods:

- check if a flash message exists: hasFlash()
- get the parameters for a flash key (which defaults to removing the flash 
message immediately, which can be disabled): getFlash()
- get all flash messages: getFlashMessages()
- remove a specific flash messages: removeFlash()
- clear all flash messages: clearFlashMessages() (not yet available, and 
actually not so super important imho)

Now I think the most common use cases will be to just use getFlashMessages() in 
the layout template, pass the parameters through the i18n layer and be done. 
However in some cases you might prefer to show some flash messages closer to a 
specific form. In this case one would call hasFlash() followed by getFlash() to 
show the flash message in the given template. Since getFlash() by default 
removes the flash message it would not show up in a subsequent 
getFlashMessages() call. The removeFlash() method can be called in case a 
Bundle is a bit trigger happy with setting flash messages and one doesnt want 
to have to overload the Bundle just to prevent these flash messages.

Note that users who really do not want to use the i18n layer can of course just 
set the final strings as the value.

Using the type its also easy to style the flash messages accordingly.

All of the above should not be too hard to implement given what is there 
already.

regards,
Lukas

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to