You are here

function library_views_data in Library 6

Same name and namespace in other branches
  1. 6.2 includes/views/library.views.inc \library_views_data()
  2. 7 includes/views/library.views.inc \library_views_data()

Implementation of hook_views_data()

File

includes/views/library.views.inc, line 37
Hooks into views module

Code

function library_views_data() {
  $data = array();

  // Basic table information.
  // Define the base group of this table. Fields that don't
  // have a group defined will go into this field by default.
  $data['library']['table']['group'] = t('Library');

  // For other base tables, explain how we join
  $data['library']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );

  // ----------------------------------------------------------------
  // Fields
  $data['library']['in_circulation'] = array(
    'title' => t('Reference Only'),
    // The item it appears as on the UI,
    'help' => t('Whether a library item is in circulation.'),
    // The help that appears on the UI,
    'filter' => array(
      'title' => t('Reference Only'),
      'handler' => 'views_handler_filter_boolean_operator',
      'label' => t('Reference Only'),
    ),
  );
  $data['library']['library_status'] = array(
    'title' => t('Item Status'),
    // The item it appears as on the UI,
    'help' => t('Whether a library item is available or unavailable. Note that this requires an additional query per row.'),
    // The help that appears on the UI,
    // Information for displaying a title as a field
    'field' => array(
      'handler' => 'library_handler_field_library_status',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'library_handler_filter_library_status',
      'label' => t('Item Status'),
    ),
  );
  $data['library']['quantity'] = array(
    'field' => array(
      'title' => t('Quantity'),
      'handler' => 'library_handler_field_quantity',
      'help' => t('Number of copies.'),
    ),
  );
  return $data;
}