function theme_coder_warning in Coder 5
Same name and namespace in other branches
- 5.2 coder.module \theme_coder_warning()
- 6.2 coder.module \theme_coder_warning()
- 6 coder.module \theme_coder_warning()
3 theme calls to theme_coder_warning()
- _coder_50_callback in includes/
coder_50.inc - Define the rule callbacks
- _coder_6x_callback in includes/
coder_6x.inc - _coder_error_msg in ./
coder.module
File
- ./
coder.module, line 1228 - Developer Module that assists with code review and version upgrade that supports a plug-in extensible hook system so contributed modules can define additional review standards.
Code
function theme_coder_warning($warning, $severity_name, $lineno = 0, $line = '') {
// Extract description from warning
if (is_array($warning)) {
$description = $warning['#description'];
$link = $warning['#link'];
$warning = $warning['#warning'];
if (isset($link)) {
$warning .= ' (' . l('Drupal Docs', $link) . ')';
}
}
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 (isset($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>';
}