You are here

function hs_taxonomy_views_views_data_alter in Hierarchical Select 6.3

Implementation of hook_views_data_alter().

File

modules/hs_taxonomy_views.module, line 192
Implementation of the Hierarchical Select API for the Taxonomy module's Views exposed filters.

Code

function hs_taxonomy_views_views_data_alter(&$data) {

  // Term view type, tid field.
  $data['term_data']['tid'] = array(
    'title' => t('Term ID'),
    'help' => t('The taxonomy term ID.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'skip base' => array(
        'node',
        'node_revision',
      ),
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'skip base' => array(
        'node',
        'node_revision',
      ),
    ),
    // Override the views_handler_filter_term_node_tid filter handler: use our
    // hs_taxonomy_views_handler_filter_term_node_tid subclass instead.
    'filter' => array(
      'handler' => 'hs_taxonomy_views_handler_filter_term_node_tid',
      'hierarchy table' => 'term_hierarchy',
      'numeric' => TRUE,
      'skip base' => array(
        'node',
        'node_revision',
      ),
    ),
  );

  // Node view type, tid field.
  $data['term_node']['tid'] = array(
    'title' => t('Term ID'),
    'help' => t('The taxonomy term ID.'),
    'field' => array(
      'title' => t('All terms'),
      'help' => t('Display all taxonomy terms associated with a node from specified vocabularies.'),
      'handler' => 'views_handler_field_term_node_tid',
      'skip base' => 'term_data',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_term_node_tid',
      'name table' => 'term_data',
      'name field' => 'name',
      'empty name field' => t('Uncategorized'),
      'numeric' => TRUE,
      'skip base' => 'term_data',
    ),
    // Override the views_handler_filter_term_node_tid filter handler: use our
    // hs_taxonomy_views_handler_filter_term_node_tid subclass instead.
    'filter' => array(
      'title' => t('Term'),
      'handler' => 'hs_taxonomy_views_handler_filter_term_node_tid',
      'hierarchy table' => 'term_hierarchy',
      'numeric' => TRUE,
      'skip base' => 'term_data',
    ),
  );

  // Node view type, tid with depth field.
  $data['node']['term_node_tid_depth'] = array(
    'group' => t('Taxonomy'),
    'title' => t('Term ID (with depth)'),
    'help' => t('The depth filter is more complex, so provides fewer options.'),
    'real field' => 'vid',
    'argument' => array(
      'handler' => 'views_handler_argument_term_node_tid_depth',
      'accept depth modifier' => TRUE,
    ),
    'filter' => array(
      'handler' => 'hs_taxonomy_views_handler_filter_term_node_tid_depth',
    ),
  );
}