stnvh / silverstripe-infoboxes
Conditional CMS info boxes.
Installs: 2 205
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 2
Open Issues: 4
Type:silverstripe-module
Requires
- composer/installers: ~1.0
- silverstripe/framework: 3.*
README
Conditional CMS info boxes.
By Stan Hutcheon - Bigfork Ltd
Installation:
Composer:
composer require stnvh/silverstripe-infoboxes ~1
Download:
Clone this repo into a folder called infoboxes
in your silverstripe installation folder.
Usage:
It currently has 5 built in checks:
- Dev mode
- Favicon existance
- Google analytics code
- Default password
- if www is used
To add a check, create a file in /mysite/code/ called InfoBox_[your_check_name].php
with the following functions:
example:
<?php class InfoBox_example implements InfoBox { public function show() { return Director::isLive(); // Our conditional code, this can be anything as long as it returns true or false } public function message() { return 'Live Mode'; // Message to be displayed } public function severity() { return 2; // 0 = severe, 1 = warning, 2 = info } public function link() { // Can be any internal or external URL, or false if none return 'http://doc.silverstripe.org/framework/en/topics/debugging/#environment-types'; } }
You can now programmatically disable specific checks via the config API. Either via config.yml:
InfoBoxes: disabled: - example - dev - www
or via _config.php:
<?php InfoBoxes::set_disabled('example'); // or InfoBoxes::set_disabled(array('www', 'dev'));
You can either use the concatenated classname (e.g InfoBox_www -> www) or the full class name.
After installing via composer, or after adding a new InfoBox, you must /dev/build