You are here

function taxonomy_term_depth_views_data in Taxonomy Term Depth 7

Implements hook_views_data() Exposes our playcount table to views

File

./taxonomy_term_depth.module, line 228
Provides some custom functionality.

Code

function taxonomy_term_depth_views_data() {

  // Our fields
  $data['taxonomy_term_data']['depth'] = array(
    'title' => t('Depth'),
    'help' => t('The depth of a taxonomy term.'),
  );

  // Adds our field in the "Fields" section of Views
  $data['taxonomy_term_data']['depth']['field'] = array(
    'handler' => 'views_handler_field_numeric',
    'click sortable' => TRUE,
  );

  // Adds our field in the "Filters" section of Views
  $data['taxonomy_term_data']['depth']['filter'] = array(
    'handler' => 'views_handler_filter_numeric',
  );

  // Adds our field in the "Sort" section of Views
  $data['taxonomy_term_data']['depth']['sort'] = array(
    'handler' => 'views_handler_sort',
  );
  $data['taxonomy_term_data']['name_depth']['field'] = array(
    'real field' => 'name',
    'title' => t('Depth Name'),
    'help' => t('Shows a term or one of it\'s parents.'),
    'handler' => 'taxonomy_term_depth_handler_field_taxonomy',
    'click sortable' => TRUE,
  );
  $data['taxonomy_term_data']['has_children']['filter'] = array(
    'real field' => 'tid',
    'title' => t('Has Children'),
    'help' => t('Filters on whether the term has children or not.'),
    'handler' => 'taxonomy_term_depth_handler_filter_has_children',
  );
  return $data;
}