You are here

function finder_views_views_data in Finder 6

Implementation of hook_views_data().

File

modules/finder_views/includes/finder_views.views.inc, line 49
Interface between finder_views.module and views.module.

Code

function finder_views_views_data() {
  $data = array();
  if (module_exists("taxonomy")) {
    $vocabs = taxonomy_get_vocabularies();
    foreach ($vocabs as $vid => $vocab) {
      $data['term_data_' . $vid]['table']['group'] = t('Taxonomy');
      $data['term_data_' . $vid]['table']['join'] = array(
        'node' => array(
          'left_table' => 'term_node',
          'left_field' => 'tid',
          'field' => 'tid',
          'table' => 'term_data',
          'extra' => array(
            'vid' => array(
              'field' => 'vid',
              'value' => $vid,
              'numeric' => TRUE,
            ),
          ),
        ),
        'node_revision' => array(
          'left_table' => 'term_node',
          'left_field' => 'tid',
          'field' => 'tid',
          'table' => 'term_data',
          'extra' => array(
            'vid' => array(
              'field' => 'vid',
              'value' => $vid,
              'numeric' => TRUE,
            ),
          ),
        ),
      );

      // Term name field
      $data['term_data_' . $vid]['name'] = array(
        'title' => t('Terms for !vocab', array(
          '!vocab' => $vocab->name,
        )),
        'help' => t('Taxonomy terms for !vocab. Note that using this can cause duplicate nodes to appear in views; you must add filters to reduce the result set.', array(
          '!vocab' => $vocab->name,
        )),
        'field' => array(
          'handler' => 'views_handler_field_taxonomy',
          'click sortable' => TRUE,
        ),
        'filter' => array(
          'handler' => 'views_handler_filter_string',
          'help' => t('Taxonomy term name.'),
        ),
      );
    }
  }
  return $data;
}