You are here

function theme_patch_manager_issuelink in Patch manager 7

Theme an issue link

1 call to theme_patch_manager_issuelink()
patch_manager_field_formatter_view in ./patch_manager.module
Implements hook_field_formatter_view().

File

./patch_manager.module, line 488
Patch manager provides developers with tools for managing patches.

Code

function theme_patch_manager_issuelink($item) {
  $nid = $item['value'];
  if (!$nid) {
    return NULL;
  }

  // Parse out the comment ID
  if (strpos($nid, '/') !== FALSE) {
    list($nid, $comment) = explode('/', $nid);
  }

  // URL options.
  $options = array();
  $options['attributes']['title'] = 'Issue status at drupal.org: ' . $item['status'];

  // Add class for coloring depending on issue status.
  $status = $item['status'];

  // Map issue status with class.
  $map = array(
    'active' => 'state-1',
    'fixed' => 'state-2',
    'closed (duplicate)' => 'state-3',
    'postponed' => 'state-4',
    "closed (won't fix)" => 'state-5',
    'closed (works as designed)' => 'state-6',
    'closed (fixed)' => 'state-7',
    'needs review' => 'state-8',
    'needs work' => 'state-13',
    'reviewed & tested by the communty' => 'state-14',
    'patch (to be ported)' => 'state-15',
    'postponed (maintainer needs more info)' => 'state-16',
    'closed (cannot reproduce)' => 'state-18',
  );
  $class = $map[$status];
  $options['attributes']['class'] = array(
    $class,
  );

  // Add CSS.
  drupal_add_css(drupal_get_path('module', 'patch_manager') . '/patch_manager.css');

  // Display.
  return l($nid, 'http://drupal.org/node/' . $nid, $options);
}