You are here

function taxonomy_image_views_tables_alter in Taxonomy Image 5

This module is a small helper module to fix an issue with a view.

File

./taxonomy_image.module, line 722
taxonomy_image.module Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.

Code

function taxonomy_image_views_tables_alter(&$data) {
  if (module_exists('taxonomy_image_link_alter')) {
    $vocabularies = taxonomy_get_vocabularies();
    foreach ($vocabularies as $voc) {
      $data["term_node_{$voc->vid}"] = array(
        'name' => 'term_node',
        'provider' => 'internal',
        'join' => array(
          'left' => array(
            'table' => 'node',
            'field' => 'nid',
          ),
          'right' => array(
            'field' => 'nid',
          ),
        ),
        'fields' => array(
          'name' => array(
            'name' => t('Taxonomy: Terms for @voc-name', array(
              '@voc-name' => $voc->name,
            )),
            'sortable' => FALSE,
            'help' => t('This will display all taxonomy terms associated with the node that are members of %voc-name. Note that this causes one extra query per row displayed, and might have a minor performance impact.', array(
              '%voc-name' => $voc->name,
            )),
            'handler' => 'taxonomy_image_handler_field_allterms',
            'vocabulary' => $voc->vid,
            'notafield' => TRUE,
            'option' => array(
              '#type' => 'select',
              '#options' => array(
                'link' => 'As links',
                'nolink' => 'Without links',
                'image' => 'As Image',
                'imagenolink' => 'As Image NO links',
              ),
            ),
          ),
        ),
        'filters' => array(
          'tid' => array(
            'name' => t('Taxonomy: Terms for @voc-name', array(
              '@voc-name' => $voc->name,
            )),
            'value' => views_taxonomy_form($voc),
            //views does handle this as array regardless what we state here due to the operators
            'value-type' => 'array',
            'tags' => $voc->tags,
            'operator' => 'views_handler_operator_andor',
            'handler' => 'views_handler_filter_tid_custom',
            'option' => 'string',
            'vocabulary' => $voc->vid,
            'help' => t("Only terms associated with %voc-name will appear in the select box for this filter. When filtering by taxonomy term you may specify the 'depth' as an option. Please see the taxonomy help for more information.", array(
              '%voc-name' => $voc->name,
            )),
          ),
        ),
      );
    }
  }
}