You are here

function library_get_table_header in Library 6

Same name and namespace in other branches
  1. 5.2 library.module \library_get_table_header()
  2. 6.2 library.module \library_get_table_header()
  3. 7 library.module \library_get_table_header()
3 calls to library_get_table_header()
library_display_items in ./library.pages.inc
library_search in ./library.module
Implementation of hook_search()
library_search_page in ./library.module
Implementation of hook_search_page()

File

./library.module, line 1316

Code

function library_get_table_header() {
  $results = array();
  $display_cat_var = FALSE;
  foreach (variable_get('library_taxonomy_display', array()) as $key => $vocab) {
    if ($vocab) {
      $display_cat_var = TRUE;
    }
  }
  $results['display_categories'] = module_exists('taxonomy') && $display_cat_var;
  $results['display_status'] = variable_get('library_list_status_display', 0) == 1;
  $results['display_quantity'] = variable_get('library_quantity_display', 0) == 1;
  $fields = array();
  $content_fields = array();
  if (module_exists('content')) {
    $content_fields = library_get_content_fields();
  }
  foreach ($content_fields as $type) {
    foreach ($type as $field) {
      if (!isset($fields[$field['field_name']]) && variable_get('library_display_field_' . $field['field_name'], 0) == 1) {
        $fields[$field['field_name']] = $field;
      }
    }
  }
  $header[]['data'] = t('Title');
  if ($results['display_categories']) {
    $header[]['data'] = t('Categories');
  }
  if (!empty($fields)) {
    foreach ($fields as $field) {
      $header[]['data'] = $field['widget']['label'];
    }
  }
  if ($results['display_quantity']) {
    $header[]['data'] = t('Quantity');
  }
  if ($results['display_status']) {
    $header[]['data'] = t('Status');
  }
  $results['header'] = $header;
  $results['fields'] = $fields;
  return $results;
}