theme_coder_review_warning($warning, $severity_name, $lineno = 0, $line = '')Format a coder_review warning to be included in results.
$warning Either summary warning description, or an array in format:
$severity_name String severity name.
$lineno Integer line number of error.
$line String contents of line.
sites/all/modules/coder/coder_review/coder_review.module, line 1961
<?php
function theme_coder_review_warning($warning, $severity_name, $lineno = 0, $line = '') {
// theme the output for the Drupal shell
if (function_exists('_coder_review_drush_is_option') && _coder_review_drush_is_option('drush')) {
return theme_drush_coder_review_warning($warning, $severity_name, $lineno, $line);
}
// Extract description from warning.
if (is_array($warning)) {
$description = isset($warning['#description']) ? $warning['#description'] : '';
$warning_msg = $warning['#warning'];
if (isset($warning['#link'])) {
$warning_msg .= ' (' . l(t('Drupal Docs'), $warning['#link']) . ')';
}
$warning = $warning_msg;
}
if ($lineno) {
$warning = t('Line @number: !warning', array('@number' => $lineno, '!warning' => $warning));
if ($line) {
$warning .= '<pre>' . check_plain($line) . '</pre>';
}
}
$class = 'coder-warning';
if ($severity_name) {
$class .= " coder-$severity_name";
}
$path = drupal_get_path('module', 'coder');
$title = t('severity: @severity', array('@severity' => $severity_name));
$img = theme('image', $path . "/images/$severity_name.png", $title, $title, array('align' => 'right', 'class' => 'coder'), FALSE);
if (!empty($description)) {
$img .= theme('image', $path . '/images/more.png', t('click to read more'), '', array('align' => 'right', 'class' => 'coder-more'), FALSE);
$warning .= '<div class="coder-description">Explanation: ' . $description . '</div>';
}
return '<div class="' . $class . '">' . $img . $warning . '</div>';
}
?>