views_taxonomy_edge.module in Taxonomy Edge 6
Same filename and directory in other branches
Integration with Views using Taxonomy Edge.
Overrides the depth arguments and uses Taxonomy Edge for these. This now allows using 'all' as a depth argument.
File
views_taxonomy_edge/views_taxonomy_edge.moduleView source
<?php
/**
* @file
*
* Integration with Views using Taxonomy Edge.
*
* Overrides the depth arguments and uses Taxonomy Edge for these.
* This now allows using 'all' as a depth argument.
*/
/**
Implements hook_views_api().
*/
function views_taxonomy_edge_views_api() {
return array(
'api' => 2,
);
}
/**
* Implementation of hook_views_handlers() to register all of the basic handlers
* views uses.
*/
function views_taxonomy_edge_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'views_taxonomy_edge') . '/handlers',
),
'handlers' => array(
'views_handler_argument_term_edge_node_tid_depth' => array(
'parent' => 'views_handler_argument_term_node_tid_depth',
),
'views_handler_argument_term_edge_node_tid_depth_modifier' => array(
'parent' => 'views_handler_argument_term_node_tid_depth_modifier',
),
'views_handler_filter_term_edge_node_tid_depth' => array(
'parent' => 'views_handler_filter_term_node_tid_depth',
),
'views_join_term_edge' => array(
'parent' => 'views_join',
),
'views_handler_sort_term_edge_hierarchy' => array(
'parent' => 'views_handler_sort',
),
),
);
}
/**
* Implements hook_views_data_alter().
*/
function views_taxonomy_edge_views_data_alter(&$data) {
// Override term_node logic
$data['node']['term_node_tid_depth'] = array(
'help' => t('Display content if it has the selected taxonomy terms, or children of the selected terms. Due to additional complexity, this has fewer options than the versions without depth.'),
'real field' => 'nid',
'argument' => array(
'title' => t('Has taxonomy term ID (with depth)'),
'handler' => 'views_handler_argument_term_edge_node_tid_depth',
'accept depth modifier' => TRUE,
),
'filter' => array(
'title' => t('Has taxonomy terms (with depth)'),
'handler' => 'views_handler_filter_term_edge_node_tid_depth',
),
);
$data['node']['term_node_tid_depth_modifier'] = array(
'title' => t('Has taxonomy term ID depth modifier'),
'help' => t('Allows the "depth" for Taxonomy: Term ID (with depth) to be modified via an additional contextual filter value.'),
'argument' => array(
'handler' => 'views_handler_argument_term_edge_node_tid_depth_modifier',
),
);
// Tell term_data how to join with the edge tables
$data['term_data']['table']['join']['term_edge'] = array(
'field' => 'tid',
'left_field' => 'tid',
'type' => 'INNER',
'handler' => 'views_join_term_edge',
);
// Hierarchy sort handler.
$data['term_data']['term_sort_hierarchy'] = array(
'group' => t('Taxonomy edge'),
'title' => t('taxonomy hierarchy order'),
'help' => t('Sort by hierarchy order'),
'sort' => array(
'handler' => 'views_handler_sort_term_edge_hierarchy',
),
);
}
Functions
Name | Description |
---|---|
views_taxonomy_edge_views_api | Implements hook_views_api(). |
views_taxonomy_edge_views_data_alter | Implements hook_views_data_alter(). |
views_taxonomy_edge_views_handlers | Implementation of hook_views_handlers() to register all of the basic handlers views uses. |