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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Should this maybe be discussed in #193482: Styling status messages in system.css?

Xano’s picture

Ahah! 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.

JohnAlbin’s picture

Actually, 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.

kika’s picture

Can 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?

Xano’s picture

'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.

This makes sense to me.

BrightLoudNoise’s picture

FileSize
38.75 KB
BrightLoudNoise’s picture

odd, I somehow lost the body of my comment. In any case, I've attached a quick grep of drupal_set_message calls as asked.

Pasqualle’s picture

Version: 7.x-dev » 9.x-dev
Issue summary: View changes

after 10 years this issue still seems relevant
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Messenger!Messeng...

Maybe in Drupal 9..

webchick’s picture

Version: 9.x-dev » 8.8.x-dev

This 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.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

zrpnr’s picture

Title: $type = 'info' for drupal_set_message() » Add type "info" to Drupal Messenger service
Issue summary: View changes
Status: Active » Needs review
FileSize
15.88 KB
17.51 KB

Updating this for 8.9.x, now instead of drupal_set_message we'd be changing the Messenger 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 in misc/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".

info message type for seven/bartik, claro and umami

thalles’s picture

I maked a little module for this, is here the link: Info Messages (https://www.drupal.org/project/info_messages)

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs issue summary update

This 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

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.