Problem/Motivation

I have extended my media:audio with a term reference field, and were able to tag my media correctly. However, when I browse to my my terms page, e.g. http://www.example.com/taxonomy/term/1, I get "There is currently no content classified with this term."

I was expecting to see the media (mp3's) connected to that term?

Proposed resolution

There are 2 different solutions:
- create a custom view for the taxonomy/term/% pages;
#1016942: Allow taxonomy/term pages to list multiple entity types
- change core to show not only 'node' entities;
#1137558: Show multiple entity types on Core taxonomy/term pages, not just 'node'

See above, and also:
#1040786: Include entities in taxonomy_index

Comments

lsolesen’s picture

Seems that it will not work in the current implementation, as taxonomy_term_page() expects nodes: http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.pages.inc/f...

JacobSingh’s picture

Category: bug » support
Status: Active » Closed (works as designed)

This is an unfortuante hold over from previous node-centric versions of Drupal. You'll either need to wait for views support or write your own handler to show a list of media items by tag.

steinmb’s picture

Title: Taxonomy integration does not seem to work correctly? » Only nodes entities are viewable by taxonomy
Project: D7 Media » Drupal core
Version: 7.x-1.0-beta3 » 8.x-dev
Component: Code » taxonomy.module
Category: support » feature
Status: Closed (works as designed) » Active

Let us try and move this then. This code from http://api.drupal.org/api/drupal/modules!taxonomy!taxonomy.pages.inc/fun... stops us from viewing files by taxonomy terms even they are first class drupal entities when expanded by http://drupal.org/project/file_entity.

<?php
 if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
    $nodes = node_load_multiple($nids);
    $build += node_view_multiple($nodes);
    $build['pager'] = array(
      '#theme' => 'pager', 
      '#weight' => 5,
    );
  }
?>

The same goes if you tagg any other entities with term ref.

johnv’s picture

Title: Only nodes entities are viewable by taxonomy » Show multiple entity types on Core taxonomy/term pages, not just 'node'

The following issues have the same problem, but they propose different solutions. Hence, a more explicit title:
- other issue: #1016942: Allow taxonomy/term pages to list multiple entity types
- this issue: #1137558: Show multiple entity types on Core taxonomy/term pages, not just 'node'

johnv’s picture

Even worse: function taxonomy_select_nodes() reads table taxonomy_index, which only contains references to tids of nodes, not other entities.

function taxonomy_select_nodes($tid, $pager = TRUE, $limit = FALSE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) {
  if (!variable_get('taxonomy_maintain_index_table', TRUE)) {
    return array();
  }
  $query = db_select('taxonomy_index', 't');
  $query->addTag('node_access');
  $query->condition('tid', $tid);
  ...
  $query->addField('t', 'nid');
  $query->addField('t', 'tid');
  ...
  return $query->execute()->fetchCol();
}
johnv’s picture

This is the issue to add 'entities' to taxonomy_index:
#1040786: Include entities in taxonomy_index

johnv’s picture

Issue summary: View changes

added template headers,
added reference to other issue.

swentel’s picture

swentel’s picture

Issue summary: View changes

added other issue to the list.