You are here

function finder_views_data in Finder 7.2

Implements hook_views_data().

File

views/finder.views.inc, line 47
Interface between finder.module and views.module.

Code

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

      // Term name field.
      $data['taxonomy_term_data_' . $vid]['name'] = array(
        'title' => t('Terms for !vocab', array(
          '!vocab' => $vocab->name,
        )),
        'help' => t('Taxonomy terms for !vocab.  Provided by the <em>Finder</em> module.', 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;
}