MDL-44729 theme_bootstrapbase: override the maintenance renderer
This patch overrides the maintenance renderer in the bootstrapbase theme in order to override the notification method in the same way we override the core renderer notification method. This ensures now that clean is standard that notifications during maintenance tasks (install, upgrade etc) look pretty.
This commit is contained in:
@@ -221,3 +221,48 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden core maintenance renderer.
|
||||
*
|
||||
* This renderer gets used instead of the standard core_renderer during maintenance
|
||||
* tasks such as installation and upgrade.
|
||||
* We override it in order to style those scenarios consistently with the regular
|
||||
* bootstrap look and feel.
|
||||
*
|
||||
* @package theme_bootstrapbase
|
||||
* @copyright 2014 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class theme_bootstrapbase_core_renderer_maintenance extends core_renderer_maintenance {
|
||||
/**
|
||||
* Renders notifications for maintenance scripts.
|
||||
*
|
||||
* We need to override this method in the same way we do for the core_renderer maintenance method
|
||||
* found above.
|
||||
* Please note this isn't required of every function, only functions used during maintenance.
|
||||
* In this case notification is used to print errors and we want pretty errors.
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $classes
|
||||
* @return string
|
||||
*/
|
||||
public function notification($message, $classes = 'notifyproblem') {
|
||||
$message = clean_text($message);
|
||||
$type = '';
|
||||
|
||||
if (($classes == 'notifyproblem') || ($classes == 'notifytiny')) {
|
||||
$type = 'alert alert-error';
|
||||
}
|
||||
if ($classes == 'notifysuccess') {
|
||||
$type = 'alert alert-success';
|
||||
}
|
||||
if ($classes == 'notifymessage') {
|
||||
$type = 'alert alert-info';
|
||||
}
|
||||
if ($classes == 'redirectmessage') {
|
||||
$type = 'alert alert-block alert-info';
|
||||
}
|
||||
return "<div class=\"$type\">$message</div>";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user