You are here

function _views_watchdog_get_severity_icon in Views Watchdog 7.3

Same name and namespace in other branches
  1. 6.3 views_watchdog.module \_views_watchdog_get_severity_icon()
  2. 6.2 views_watchdog.module \_views_watchdog_get_severity_icon()

Helper function; retrieves severity icon.

1 call to _views_watchdog_get_severity_icon()
views_handler_field_watchdog_severity::render in views/handlers/views_handler_field_watchdog_severity.inc
Render the field.

File

./views_watchdog.module, line 109
This module extends the Views module and allows to create customized lists (pages, blocks, feeds) of watchdog entries.

Code

function _views_watchdog_get_severity_icon($code, $path) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['severity_icon'] =& drupal_static(__FUNCTION__);
  }
  $severity_icon =& $drupal_static_fast['severity_icon'];
  if (!isset($severity_icon[$code])) {
    $path = trim($path);
    $title = _views_watchdog_get_severity($code, 'title');
    $severity_icon[$code] = !empty($path) && is_file($path) ? theme('image', array(
      'path' => $path,
      'alt' => $title,
      'title' => $title,
    )) : '';
  }
  return $severity_icon[$code];
}