You are here

function book_views_tables in Views (for Drupal 7) 5

This include file implements views functionality on behalf of book.module

File

modules/views_book.inc, line 7

Code

function book_views_tables() {
  $tables['book'] = array(
    'name' => 'book',
    'provider' => 'internal',
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'vid',
      ),
      'right' => array(
        'field' => 'vid',
      ),
    ),
    "filters" => array(
      'parent' => array(
        'name' => t('Book: Parent Node'),
        'list' => 'views_handler_filter_book_parent_zero',
        'operator' => 'views_handler_operator_andor',
        'help' => t('This allows you to filter books based on parent node.'),
      ),
    ),
    'sorts' => array(
      'weight' => array(
        'name' => t('Book: Weight'),
        'handler' => 'views_handler_sort_book_weight',
        'help' => t('This will sort the view by book weight, if that is applicable.'),
      ),
    ),
  );
  $tables['book_parent_node'] = array(
    'name' => 'node',
    'provider' => 'internal',
    'join' => array(
      'left' => array(
        'table' => 'book',
        'field' => 'parent',
      ),
      'right' => array(
        'field' => 'nid',
      ),
    ),
    'fields' => array(
      'title' => array(
        'name' => t('Book: Parent Title'),
        'handler' => array(
          'views_handler_field_book_parent_title' => t('As Link'),
          'views_handler_field_book_parent_title_nl' => t('Without Link'),
        ),
        'addlfields' => array(
          'nid',
        ),
        'help' => t('Display the title of the parent node'),
      ),
    ),
    'sorts' => array(
      'title' => array(
        'name' => t('Book: Parent Title'),
        'help' => t('Sort by the title of the parent node'),
      ),
    ),
  );
  return $tables;
}