PHP code example of stnvh / silverstripe-infoboxes

1. Go to this page and download the library: Download stnvh/silverstripe-infoboxes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stnvh / silverstripe-infoboxes example snippets




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';
	}
    
}




InfoBoxes::set_disabled('example');
// or
InfoBoxes::set_disabled(array('www', 'dev'));