You are here

function pm_helper_get_fa_icon in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 includes/pm.icon.inc \pm_helper_get_fa_icon()
  2. 7.2 pm.module \pm_helper_get_fa_icon()

Helper to attach fontawesome icons.

2 calls to pm_helper_get_fa_icon()
pm_icon in ./pm.module
Provides a Project Management icon.
theme_pm_dashboard_link in ./pm.theme.inc
Provides HTML for Project Management links.

File

./pm.module, line 551
Main module file for the Project Management module.

Code

function pm_helper_get_fa_icon($key, $default_class = 'fa_wrench') {
  if (variable_get('pm_icon', PM_ICON_SET_DEFAULT_BEHAVIOUR) == PM_ICON_SET_NO_ICON) {
    return '';
  }
  $key = str_replace(' ', '_', $key);
  $key = str_replace('-', '_', $key);
  switch ($key) {
    case 'pmconfiguration':
      $class = 'fa-gear';
      break;
    case 'pmexpenses':
      $class = 'fa-money';
      break;
    case 'pmnotes':
      $class = 'fa-file-o';
      break;
    case 'pmtimetrackings':
      $class = 'fa-clock-o';
      break;
    case 'pmtickets':
      $class = 'fa-ticket';
      break;
    case 'pmtasks':
      $class = 'fa-tasks';
      break;
    case 'pmprojects':
      $class = 'fa-cubes';
      break;
    case 'pmteams':
      $class = 'fa-users';
      break;
    case 'pmorganizations':
      $class = 'fa-institution';
      break;
    case 'pmissues':
      $class = 'fa-cube';
      break;
    case 'application_add':
      $class = 'fa-plus';
      break;
    case 'application_delete':
      $class = 'fa-remove pm-status-danger-onfocus';
      break;
    case 'application_edit':
      $class = 'fa-edit';
      break;

    // Issue type.
    case 'bug':
      $class = 'fa-bug';
      break;
    case 'task':
      $class = 'fa-tasks';
      break;
    case 'feature_request':
      $class = 'fa-ticket';
      break;
    case 'support':
      $class = 'fa-phone';
      break;

    // Project type.
    case 'development':
      $class = 'fa-flask';
      break;

    // Progress.
    case 'in_progress':
      $class = 'fa-play pm-status-info';
      break;
    case 'completed':
      $class = 'fa-check pm-status-success';
      break;
    case 'on_hold':
      $class = 'fa-pause pm-status-warning';
      break;
    case 'inserted':
      $class = 'fa-square pm-status-normal';
      break;

    // Priority.
    case '1_low':
      $class = 'fa-circle pm-status-info';
      break;
    case '2_normal':
      $class = 'fa-circle pm-status-success';
      break;
    case '3_high':
      $class = 'fa-circle pm-status-warning';
      break;
    case '4_urgent':
      $class = 'fa-circle pm-status-danger';
      break;
    case 'default':
      $class = '';
      break;
    default:

      // @todo: Discuss how to handle other keys.
      return '';
  }
  return "<i class='fa pm-icon {$class} fa-fw'></i>";
}