-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean the use of flash messages #246
Comments
I don't understand the issue. There is no "standard" for setting flash messages, though maybe there should be. |
@lsmith77 putting the actual message as key of the flash message and the class as message seems wrong. As the flash message impacts the next request, we cannot be sure that they will be rendered by FOSUserBundle (or that they are set by FOSUserBundle for the first request reaching it) |
But what else could we do? And how would anything else ensure a better outcome? |
dunno. This issue is about thinking about the issue to eventually find a better way than the current one. |
well maybe we should define a standard and add it to the docs as a best practice then. |
Hello- I came across a post that relates to this, I believe: https://coderwall.com/p/ybup5a Why not pass your setFlash $value more like this: $this->setFlash('notice', $this->container->get('translator')->trans('change_password.flash.success', array(), 'FOSUserBundle')); In any event, thank you for the excellent bundle. |
Here's how I achieved this, probably as intended. I just extended all the controllers and overrode the setFlash method. Example here is the Registration Controller:
Which allows the following in my top-level .twig template:
|
@bartclarkson this issue has been resolved several months ago already. |
@stof how you resolved this issue? |
I don't see any changes? |
The 2.0 version (master branch) is translating messages in the listener setting them, and sets it properly (rather than using the message as key and the type as value) |
btw, the commit doing the change is linked (it was the commit closing the issue) |
Currently, the bundle does not use flash messages in a clean way, setting the translation key as message key and the CSS class as message. This works well as long as the flash message is rendered using the bundle's layout but breaks if the user replaces it.
The layout breaks also flash messages set by the user before going to a FOSUB page.
The text was updated successfully, but these errors were encountered: