Skip to content

Module: Informer

Oleg Ivanchenko edited this page Oct 18, 2026 · 2 revisions

Module: Informer

The Informer module displays a dismissible notification bar at the top of the page with a spinning indicator. Useful for maintenance notices, announcements, or alerts.

Features

  • Notification bar above page content with spinning indicator
  • Dismissible — visitors can close the bar; preference stored in a cookie
  • Auto-reset — saving settings resets all dismissals so everyone sees the updated bar
  • HTML support — notification text supports sanitized HTML for links, bold, and other formatting
  • Customizable colors — background and text colors via admin panel
  • Translated admin UI — admin labels are translated (en, ru); the bar text itself is shown as entered
  • Demo mode — automatically enabled with admin access info when OCMS_DEMO_MODE=true

Admin Settings

Navigate to Admin > Modules > Informer to configure:

Setting Description Default
Enabled Show/hide the notification bar Off
Notification Text The message (HTML allowed) Empty
Background Color Bar background color #1e40af (blue)
Text Color Text and icon color #ffffff (white)

The admin page includes a live preview that updates as you change settings.

HTML in Notification Text

Check our <a href="/sale">sale page</a> for <strong>50% off</strong>!

The text is sanitized before rendering (the same bluemonday UGC policy as page HTML): scripts, event-handler attributes and inline style attributes are removed. Use the color settings for styling.

The text is rendered as-is for every language; it is not looked up in locale files.

Cookie-Based Dismissal

When a visitor clicks the close button:

  1. The bar is hidden immediately
  2. A cookie (ocms_informer_dismissed) is set with the current settings version and a 365-day expiration
  3. On subsequent visits, the bar stays hidden as long as the cookie version matches

When an admin saves settings, an internal version counter increments, invalidating all existing dismissal cookies so the bar reappears for all visitors.

Theme Integration

The informer bar is injected via the informerBar template function in the theme's base layout, passing the CSP nonce:

<body>
    {{informerBar .CSPNonce}}
    ...
</body>

Both core themes include this integration. Custom themes should add the same line after <body>. See Theme System for details.

Technical Details

Property Value
Module name informer
Database table informer_settings
Cookie name ocms_informer_dismissed
Admin URL /admin/informer
Public route GET /api/informer/demo-credentials (demo mode only; serves the demo password to the banner)
Template function informerBar

Clone this wiki locally