How to display a warning message on all pages of the site, using rules. When I created a rule with the action "Display a message on the site," it appears that a single time. I hope it will display permanence and on all my pages.


It depends on what event you have subscribe your rule for.

If you choose event as 'Drupal is initialised' and then choose action as 'Show message on site',the message will be showed on every page request, only thing you would like to make sure is disabled the repeat behavior of message, so that message does not stack up on every page request.

Here goes the export of such rule, that might give you a good starting point.

{ "rules_system_wide_message" : {
    "LABEL" : "System Wide Message",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "DO" : [
      { "drupal_message" : { "message" : "Site wide message", "repeat" : "0" } }
| improve this answer | |
  • thank you, that's exactly what I need except I wish the chips flags in the message. Is it possible ? – user54067 Sep 26 '16 at 11:14
  • you can use html in the message body, if that answers your question. As an example <div class="flag">Site wide message</div> – arpitr Sep 26 '16 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy