Problem/Motivation
A type "info" would be useful for messages that are simply informative- Drupal currently is limited to "status", "warning", and "error"
Proposed resolution
Add "info" to Drupal Messenger and create a style for classy/seven/bartik and claro.
Original report by @Xano
Currently, $type = 'status'
is being used for messages that simply want to inform users of something. In most themes these are styles green, as if some action has been performed succesfully. I suggest changing $type = 'status'
to $type = 'success'
and add a $type = 'info'
for status information, which could be coloured blue by default.
Comment | File | Size | Author |
---|---|---|---|
#11 | info-messages.png | 17.51 KB | zrpnr |
#11 | 375928-11.patch | 15.88 KB | zrpnr |
#6 | drupal_set_message.txt | 38.75 KB | BrightLoudNoise |
Comments
Comment #1
Dave ReidShould this maybe be discussed in #193482: Styling status messages in system.css?
Comment #2
XanoAhah! That explains why I couldn't find an issue about this. They hijacked that one to add a new status :-P
I think it's best to use this issue for adding the new status and that one for all styling issues, since this one is about PHP and that one about CSS.
Comment #3
JohnAlbinActually, if you look at my #20 comment over there (http://drupal.org/node/193482#comment-1252122), you'll see my patch isn't hijacking this issue. :-)
yoroy has already created the icon for "ok" status, but its not used in my patch. I think we should continue discussing a new $type in this issue.
'success', 'info', 'warning', and 'error' sound good to me! What do we want the new default to be? info or success? or should we make the field required? If we make it a non-default required field, then we force people to think about what $type to use.
Comment #4
kika CreditAttribution: kika commentedCan somebody do a quick grep on drupal_set_message() calls in core so we can get a idea what type of messages are out there and which ones seems to be default ones?
Comment #5
XanoThis makes sense to me.
Comment #6
BrightLoudNoise CreditAttribution: BrightLoudNoise commentedComment #7
BrightLoudNoise CreditAttribution: BrightLoudNoise commentedodd, I somehow lost the body of my comment. In any case, I've attached a quick grep of drupal_set_message calls as asked.
Comment #8
Pasqualleafter 10 years this issue still seems relevant
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Messenger!Messeng...
Maybe in Drupal 9..
Comment #9
webchickThis came up in #2988970: Layout Builder should make it easier to modify the default layout for an entity type when viewing an entity. Since this would just be an API addition, I believe we could do this in 8.8.x, so moving back.
Comment #11
zrpnrUpdating this for 8.9.x, now instead of
drupal_set_message
we'd be changing theMessenger
service. I agree adding an "info" would be useful, but I'm concerned that changing "status" to "success" would be a big BC break since that has been such an established default for so long. I'd definitely be interested in ideas how to make that happen, the green checkmark certainly looks like "success" and "info" would be a more neutral indicator.To get this started, this patch adds a
TYPE_INFO
and a new method to the MessengerInterface for Messenger and LegacyMessenger (since that also implements MessengerInterface).I updated the core themes to show a styled "info" status message.
I'm not sure how the colors in classy were decided on but I picked a blue from the
misc/icons
folder and used that as a starting point for the background, color and border-color. I made an svg icon based on some of the other circle svg inmisc/icons
.For Claro I found an info icon in the Figma styleguide and used a blue from the base variables that had decent contrast against the black background added in #3023301: Messages style update.
Umami has a unique "help" style, I copied that look for "info".
Comment #12
thallesI maked a little module for this, is here the link: Info Messages (https://www.drupal.org/project/info_messages)
Comment #19
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
This patch will need to be updated as some of the classes were deprecated in D8 and removed in D9. And some of the themes deprecated in D9 and removed in D10.
Tagged for issue summary update for what is needed still for D10