2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-sitebanner

Site-wide banners activated through the CMS

image

nzta/silverstripe-sitebanner

Site-wide banners activated through the CMS

  • Friday, February 9, 2018
  • by NZTA
  • Repository
  • 1 Watchers
  • 6 Stars
  • 1,050 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

Site Wide Banners

Build Status, (*1)

Allows CMS authors to create site-wide banners, to alert visitors of important information regardless of the page they're viewing., (*2)

Features

  • Themeable templates
  • Configure type of alert (defaults to "info", "warning" and "alert")
  • Multiple concurrent alerts
  • Set start/end dates for alert
  • Permission controls
  • Localisation of CMS UI controls and labels
  • Preview and publish through versioning
  • CMS users can make banners "dismissible", allowing users to hide banners after reading.
  • Rich-text editing (insert links and images)
  • Optional: Sorting through gridfieldextensions
  • Support for subsites

Screenshot

CMS Preview, (*3)

Installation

composer require nzta/silverstripe-sitebanner:

Configuration

Add the following to your YAML config to activate the module:, (*4)

SilverStripe\SiteConfig\SiteConfig:
  extensions:
    - NZTA\SiteBanner\Extensions\SiteConfigExtension

The site banner can be configured in admin/settings now., (*5)

Templates

In order to show the banners, you need to add them to your template:, (*6)

<% loop $SiteConfig.SiteBanners %>
    <div id="site-banner-$ID" class="site-banner site-banner-$Type" role="alert" data-id="$ID" aria-hidden="true">
        $Content
        <% if $Dismiss %>
            <button class="site-banner-close" aria-label="Close" data-id="$ID">×</button>
        <% end_if %>
    </div>
<% end_loop %>

Bootstrap Styles

If you're using Bootstrap, it's easy to get useful default styles for alerts through a combination of contextual backgrounds and icons., (*7)

<% loop $SiteConfig.SiteBanners %>
    <% if $Type == 'info' %>
        <p class="bg-info site-banner site-banner-$Type" role="alert" data-id="$ID" aria-hidden="true">
            <span class="glyphicon glyphicon-info-sign" aria-hidden="true" />
            $Content
        </p>
    <% end_if %>
    <% if $Type == 'warning' %>
        <p class="bg-warning site-banner site-banner-$Type" role="alert" data-id="$ID" aria-hidden="true">
            <span class="glyphicon glyphicon-warning-sign" aria-hidden="true" />
            $Content
        </p>
    <% end_if %>
    <% if $Type == 'alert' %>
        <p class="bg-danger site-banner site-banner-$Type" role="alert" data-id="$ID" aria-hidden="true">
            <span class="glyphicon glyphicon-warning-sign" aria-hidden="true" />
            $Content
        </p>
    <% end_if %>
<% end_loop %>

Examples on the SilverStripe default theme:, (*8)

Info styling, (*9)

Warning styling, (*10)

Alert styling, (*11)

Permissions

By default, every author with access to the "Settings" section (EDIT_SITECONFIG permission code) can set alerts. You can customise this by YAML configuration:, (*12)

NZTA\SiteBanner\Models\SiteBanner:
  required_permission_codes:
    - ADMIN

Sorting

You can allow authors to sort multiple alerts by installing the gridfieldextensionsn module. It'll get automatically picked up by the code., (*13)

Limitations

The Versions

09/02 2018

dev-master

9999999-dev https://github.com/NZTA/silverstripe-sitebanner

Site-wide banners activated through the CMS

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

cms silverstripe banner

17/05 2017

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/NZTA/silverstripe-sitebanner

Site-wide banners activated through the CMS

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

cms silverstripe banner