summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorspiderr <spiderr@bitweaver.org>2022-02-14 13:10:20 -0500
committerspiderr <spiderr@bitweaver.org>2022-02-14 13:10:20 -0500
commitf6ad14ae8cd237fef6307ccde82da635243573e3 (patch)
treebd2018490808023f52e2e505d3be467f9877375e /includes
parentc8d6a47080a747948c8b0f484e30c3c7fbc4a09f (diff)
downloadthemes-f6ad14ae8cd237fef6307ccde82da635243573e3.tar.gz
themes-f6ad14ae8cd237fef6307ccde82da635243573e3.tar.bz2
themes-f6ad14ae8cd237fef6307ccde82da635243573e3.zip
clean up themes_feedback_to_html to use <ul> if multiple items sent in on same alertClass
Diffstat (limited to 'includes')
-rw-r--r--includes/classes/BitThemes.php26
1 files changed, 19 insertions, 7 deletions
diff --git a/includes/classes/BitThemes.php b/includes/classes/BitThemes.php
index 5694b01..90c83a8 100644
--- a/includes/classes/BitThemes.php
+++ b/includes/classes/BitThemes.php
@@ -2204,9 +2204,10 @@ function themes_feedback_to_html( $params ) {
// maybe params were passed in separately
$hash = &$params;
}
- $feedback = '';
$i = 0;
$color = isset( $hash['color'] )?$hash['color']:"000000";
+
+ $output = array();
foreach( $hash as $key => $val ) {
if( $val ) {
$keys = array( 'warning', 'success', 'error', 'important', 'note' );
@@ -2235,10 +2236,10 @@ function themes_feedback_to_html( $params ) {
foreach( $val as $valText ) {
if( is_array( $valText ) ) {
foreach( $valText as $text ) {
- $feedback .= '<span class="inline-block '.$alertClass.'">'.$text.'</span>';
+ $output[$alertClass][] = $text;
}
} else {
- $feedback .= '<span class="inline-block '.$alertClass.'">'.$valText.'</span>';
+ $output[$alertClass][] = $valText;
}
}
@@ -2250,10 +2251,10 @@ function themes_feedback_to_html( $params ) {
if ( $key != 'color' ) {
if( is_array( $val ) ) {
foreach( $val as $text ) {
- $feedback .= '<span class="'.$key.'">'.$text.'</span>';
+ $output[$key][] = $text;
}
} else {
- $feedback .= '<span class="'.$key.'">'.$val.'</span>';
+ $output[$key][] = $val;
}
}
}
@@ -2261,8 +2262,19 @@ function themes_feedback_to_html( $params ) {
}
$html = '';
- if( !empty( $feedback ) ) {
- $html .= $feedback;
+ foreach( $output as $cssClass => $messages ) {
+ $html .= '<span class="inline-block '.$cssClass.'">';
+ if( count( $messages ) == 1 ) {
+ $html .= current( $messages );
+ } else {
+ $html .= '<ul>';
+ foreach( $messages as $msgText ) {
+ $html .= '<li>'.$msgText.'</li>';
+ }
+ $html .= '</ul>';
+ }
+
+ $html .= '</span>';
}
return $html;
}