Skip to content
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

[Notifier] Customise browser Flash Message level with importance #43187

Closed
benr77 opened this issue Sep 27, 2021 · 0 comments · Fixed by #45047
Closed

[Notifier] Customise browser Flash Message level with importance #43187

benr77 opened this issue Sep 27, 2021 · 0 comments · Fixed by #45047

Comments

@benr77
Copy link
Contributor

benr77 commented Sep 27, 2021

I've just implemented browser flash messages using the Notifier component. Works well and easy to set up.

However, the first thing I noticed is that the "type" for the flash message is hard-coded to notification

$request->getSession()->getFlashBag()->add('notification', $message);

Previously my flash messages would use the types of info / error etc to display flash messages using different colour schemes (e.g. red alert panel for error messages, light green for success notifications), but this no longer appears to be supported.

I think it would be nice to be able to set the flash message "type" based on the importance value of the notification option.

Can I get some feedback on whether this is a good idea, before I put together a PR?

Presumably the only necessary modification would just be to use the importance string as the flash message type - e.g.

$request->getSession()->getFlashBag()->add($notification->getImportance(), $message);

@fabpot fabpot closed this as completed Mar 18, 2022
fabpot added a commit that referenced this issue Mar 26, 2022
…ype (benr77, fabpot)

This PR was merged into the 6.1 branch.

Discussion
----------

[Notifier] Use Importance level to set flash message type

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #43187
| License       | MIT

Instead of hard-coding the flash message type, set the flash message type based on the "importance" level of the notification.

Commits
-------

1904fed Add missing dep
7ce1b9c [Notifier] Add Importance level to flash message type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants