Created
March 20, 2018 19:38
-
-
Save quinns/f101574c7ec185e13390f056a34b18ca to your computer and use it in GitHub Desktop.
Fix Drupal's Bootstrap theme not working properly with dpm() or dsm() devel function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// fix for broken dpm() output with bootstrap. | |
// see https://www.drupal.org/node/2824578#comment-12075185 | |
function THEMENAME_status_messages($variables){ | |
$display = $variables['display']; | |
$output = ''; | |
$status_heading = array( | |
'status' => t('Status message'), | |
'error' => t('Error message'), | |
'warning' => t('Warning message'), | |
); | |
foreach (drupal_get_messages($display) as $type => $messages) { | |
$output .= "<div class=\"messages $type\">\n"; | |
if (!empty($status_heading[$type])) { | |
$output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>\n"; | |
} | |
if (count($messages) > 1) { | |
$output .= " <ul>\n"; | |
foreach ($messages as $message) { | |
$output .= ' <li>' . $message . "</li>\n"; | |
} | |
$output .= " </ul>\n"; | |
} | |
else { | |
$output .= reset($messages); | |
} | |
$output .= "</div>\n"; | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment