You are here

function template_preprocess_quail_api_results in Quail API 7

Same name and namespace in other branches
  1. 8 quail_api.module \template_preprocess_quail_api_results()

Template preprocess function for quail_api_results.tpl.php.

File

./quail_api.module, line 75
Module file for the quail api.

Code

function template_preprocess_quail_api_results(&$variables) {
  drupal_add_css(drupal_get_path('module', 'quail_api') . '/includes/quail_api.css');
  $root_class_name = 'quail_api-results';
  $variables['severity_id'] = NULL;
  $variables['severity_machine_name'] = '';
  $variables['severity_human_name'] = '';
  $variables['severity_description'] = '';
  $variables['base_class'] = $root_class_name;
  $variables['specific_class'] = 'unknown';
  if (empty($variables['severity_results']) || !isset($variables['severity_results']['total'])) {
    $severity_results = array(
      'total' => 0,
    );
  }
  if (is_numeric($variables['id'])) {
    if (empty($variables['severity_array'])) {
      $severity_level = quail_api_get_display_levels($variables['id']);
    }
    else {
      $severity_level = $variables['severity_array'];
    }
    $variables['severity_id'] = $severity_level['id'];
    $variables['severity_machine_name'] = $severity_level['machine_name'];
    $variables['severity_human_name'] = $severity_level['human_name'];
    $variables['severity_description'] = $severity_level['description'];
    $variables['specific_class'] = $root_class_name . '-' . $severity_level['machine_name'];
  }
  unset($variables['severity_array']);

  // limit title_block to a specific list of html tags
  if (!in_array($variables['title_block'], array(
    'h2',
    'h3',
    'h4',
    'h5',
    'h6',
    'div',
    'span',
  ))) {
    $variables['title_block'] = 'h3';
  }
}