You are here

views_taxonomy_edge.views.inc in Taxonomy Edge 7.2

Integration with Views using Taxonomy Edge.

Add extra views capabilities for Taxonomy Edge

File

views_taxonomy_edge/views_taxonomy_edge.views.inc
View source
<?php

/**
 * @file
 *
 * Integration with Views using Taxonomy Edge.
 *
 * Add extra views capabilities for Taxonomy Edge
 */

/**
 * Implements hook_views_data().
 */
function views_taxonomy_edge_views_data() {
  $data = array();

  // Taxonomy Edges
  $data['taxonomy_term_edge']['table']['group'] = t('Taxonomy edge');

  // Advertise this table as a possible base table
  $data['taxonomy_term_edge']['table']['base'] = array(
    'field' => 'eid',
    'title' => t('Term edge'),
  );

  // Joins for this table
  $data['taxonomy_term_edge']['table']['join'] = array(
    'taxonomy_term_edge_path' => array(
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
    ),
    'taxonomy_term_edge_order' => array(
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
    ),
    'taxonomy_term_data' => array(
      'left_table' => 'taxonomy_term_edge_path',
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
      'handler' => 'views_join_term_edge',
    ),
  );

  // Columns
  $data['taxonomy_term_edge']['eid'] = array(
    'title' => t('Edge ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term edge ID'),
  );
  $data['taxonomy_term_edge']['pid'] = array(
    'title' => t('Path ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term path ID'),
  );
  $data['taxonomy_term_edge']['parent'] = array(
    'title' => t('Parent path ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term parent path ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'name field' => 'parent',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['taxonomy_term_edge']['parent_tid'] = array(
    'title' => t('Parent term ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term parent term ID'),
    'real field' => 'parent',
    'argument' => array(
      'handler' => 'views_handler_argument_term_edge_parent_tid',
      'name field' => 'parent',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_term_edge_parent_tid',
    ),
  );
  $data['taxonomy_term_edge']['parent'] = array(
    'title' => t('Parent path ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term parent path ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'name field' => 'parent',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['taxonomy_term_edge']['distance'] = array(
    'title' => t('Distance to root'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term\'s distance to the root'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'name field' => 'distance',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // Taxonomy Paths
  $data['taxonomy_term_edge_path']['table']['group'] = t('Taxonomy edge');

  // Advertise this table as a possible base table
  $data['taxonomy_term_edge_path']['table']['base'] = array(
    'field' => 'pid',
    'title' => t('Term path'),
  );

  // Joins for this table
  $data['taxonomy_term_edge_path']['table']['join'] = array(
    'taxonomy_term_data' => array(
      'left_field' => 'tid',
      'field' => 'tid',
      'type' => 'INNER',
    ),
    'taxonomy_term_edge_order' => array(
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
    ),
    'taxonomy_term_edge' => array(
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
      'handler' => 'views_join_term_edge',
    ),
  );

  // Columns
  $data['taxonomy_term_edge_path']['tid'] = array(
    'title' => t('Term ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term ID'),
  );
  $data['taxonomy_term_edge_path']['pid'] = array(
    'title' => t('Path ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term path ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'name field' => 'pid',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // Taxonomy Ordering
  $data['taxonomy_term_edge_order']['table']['group'] = t('Taxonomy edge');

  // Advertise this table as a possible base table
  $data['taxonomy_term_edge_order']['table']['base'] = array(
    'field' => 'oid',
    'title' => t('Term order'),
  );

  // Joins for this table
  $data['taxonomy_term_edge_order']['table']['join'] = array(
    'taxonomy_term_edge_path' => array(
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
    ),
    'taxonomy_vocabulary' => array(
      'left_field' => 'vid',
      'field' => 'vid',
    ),
    'taxonomy_term_data' => array(
      'left_table' => 'taxonomy_term_edge_path',
      'left_field' => 'pid',
      'field' => 'pid',
      'type' => 'INNER',
      'extra' => '{taxonomy_term_edge_order}.vid = {taxonomy_term_data}.vid',
    ),
  );

  // Columns
  $data['taxonomy_term_edge_order']['oid'] = array(
    'title' => t('Order ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term order ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['taxonomy_term_edge_order']['vid'] = array(
    'title' => t('Vocabulary ID'),
    // The item it appears as on the UI,
    'help' => t('The vocabulary ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'name field' => 'vid',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
  );
  $data['taxonomy_term_edge_order']['pid'] = array(
    'title' => t('Path ID'),
    // The item it appears as on the UI,
    'help' => t('The taxonomy term path ID'),
  );
  return $data;
}

Functions