function views_analyze_format_result in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 includes/analyze.inc \views_analyze_format_result()
- 6.2 includes/analyze.inc \views_analyze_format_result()
Format the analyze result into a message string.
This is based upon the format of drupal_set_message which uses separate boxes for "ok", "warning" and "error".
1 call to views_analyze_format_result()
- views_ui_analyze_view_form in includes/
admin.inc - Form constructor callback to display analysis information on a view.
File
- includes/
analyze.inc, line 35 - Contains the view analyze tool code.
Code
function views_analyze_format_result($view, $messages) {
if (empty($messages)) {
$messages = array(
views_ui_analysis(t('View analysis can find nothing to report.'), 'ok'),
);
}
$types = array(
'ok' => array(),
'warning' => array(),
'error' => array(),
);
foreach ($messages as $message) {
if (empty($types[$message['type']])) {
$types[$message['type']] = array();
}
$types[$message['type']][] = $message['message'];
}
$output = '';
foreach ($types as $type => $messages) {
$type .= ' messages';
$message = '';
if (count($messages) > 1) {
$message = theme('item_list', array(
'items' => $messages,
));
}
elseif ($messages) {
$message = array_shift($messages);
}
if ($message) {
$output .= "<div class=\"{$type}\">{$message}</div>";
}
}
return $output;
}