summaryrefslogtreecommitdiff
path: root/library/WT/Theme/BaseTheme.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/WT/Theme/BaseTheme.php')
-rw-r--r--library/WT/Theme/BaseTheme.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/library/WT/Theme/BaseTheme.php b/library/WT/Theme/BaseTheme.php
index 4d887193f4..3621b7a78b 100644
--- a/library/WT/Theme/BaseTheme.php
+++ b/library/WT/Theme/BaseTheme.php
@@ -499,6 +499,32 @@ abstract class BaseTheme {
}
/**
+ * Add HTML markup to create an alert
+ *
+ * @param string $html The content of the alert
+ * @param string $level One of 'success', 'info', 'warning', 'danger'
+ * @param boolean $dismissible If true, add a close button.
+ *
+ * @return string
+ */
+ public function htmlAlert($html, $level, $dismissible) {
+ if ($dismissible) {
+ return
+ '<div class="alert alert-' . $level . ' alert-dismissible role="alert">' .
+ '<button type="button" class="close" data-dismiss="alert" aria-label="' . WT_I18N::translate('close') . '">' .
+ '<span aria-hidden="true">&times;</span>' .
+ '</button>' .
+ $html .
+ '</div>';
+ } else {
+ return
+ '<div class="alert alert-' . $level . ' role="alert">' .
+ $html .
+ '</div>';
+ }
+ }
+
+ /**
* Display an icon for this fact.
*
* @param WT_Fact $fact