Download the PHP package nzta/silverstripe-sitebanner without Composer

On this page you can find all versions of the php package nzta/silverstripe-sitebanner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-sitebanner

Site Wide Banners

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

Features

Screenshot

Requirements

For a Silverstripe CMS ^4 compatible version of this module, please see the releases <=3.0.1.

Installation

composer require nzta/silverstripe-sitebanner

Configuration

Site settings

Add the following to your YAML config to configure the module:

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

Add the following environment variable to you .env file to activate the module in site settings:

The site banner can be configured in admin/settings now.

Note: The site settings interface is a legacy feature that exists to keep background compatibility for anyone who still want to use this interface. This feature won't receive future updates, and we recommend using the default implementation with model admin. With admin model we are not forced to expose site settings to CMS users who must only be allowed to managed site banners.

Model admin

By default, the site banners are managed from the model admin interface.

Templates

In order to show the banners, you need to add them to your template:

<% loop $SiteBanners %>
    <div id="site-banner-$ID" class="site-banner site-banner-$Type site-banner--hidden" role="alert" data-id="$ID" aria-hidden="true" data-nosnippet>
        $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.

<% loop $SiteBanners %>
    <% if $Type == 'info' %>
        <p class="bg-info site-banner site-banner-$Type site-banner--hidden" role="alert" data-id="$ID" aria-hidden="true" data-nosnippet>
            <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 site-banner--hidden" role="alert" data-id="$ID" aria-hidden="true" data-nosnippet>
            <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 site-banner--hidden" role="alert" data-id="$ID" aria-hidden="true" data-nosnippet>
            <span class="glyphicon glyphicon-warning-sign" aria-hidden="true" />
            $Content
        </p>
    <% end_if %>
<% end_loop %>

Examples on the SilverStripe default theme:

Features

Display banners only on the selected pages

NZTA\SiteBanner\Extensions\PageSelectionExtension

Add the followig to your YML file to enable the fature

Then you are going to have a tab with gridfield to select the pages a banner must be visible on that page only.

In template, you will need to pass the page ID to <% loop $SiteBanners($PageID) %>

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:

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.

Limitations


All versions of silverstripe-sitebanner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
silverstripe/cms Version ^6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nzta/silverstripe-sitebanner contains the following files

Loading the files please wait ...