summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-01-26 18:24:22 +0000
committerGreg Roach <fisharebest@gmail.com>2015-01-26 18:24:22 +0000
commit8434898ad9a23a96a78d7558e3e12ec949ecc127 (patch)
treeda7181bc01ebfff4f003fdda85e50124ae79a2cd /library
parent4e2c6655b416f9637464819679b6a5243f736017 (diff)
downloadwebtrees-8434898ad9a23a96a78d7558e3e12ec949ecc127.tar.gz
webtrees-8434898ad9a23a96a78d7558e3e12ec949ecc127.tar.bz2
webtrees-8434898ad9a23a96a78d7558e3e12ec949ecc127.zip
Allow themes to style alerts
Diffstat (limited to 'library')
-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