diff --git a/modules/taxonomy/taxonomy.api.php b/modules/taxonomy/taxonomy.api.php index 10575c5..5667eb9 100644 --- a/modules/taxonomy/taxonomy.api.php +++ b/modules/taxonomy/taxonomy.api.php @@ -184,9 +184,9 @@ function hook_taxonomy_term_delete($term) { /** * Act on a taxonomy term that is being assembled before rendering. * - * The module may add elements to $term->content prior to rendering. This hook - * will be called after hook_view(). The structure of $term->content is a - * renderable array as expected by drupal_render(). + * The module may add elements to $term->content prior to rendering. The + * structure of $term->content is a renderable array as expected by + * drupal_render(). * * @param $term * The term that is being assembled for rendering. diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 905923d..9be7dfc 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -762,7 +762,7 @@ function taxonomy_term_show($term) { * @param $view_mode * View mode, e.g. 'full', 'teaser'... * @param $weight - * An integer representing the weight of the first node in the list. + * An integer representing the weight of the first taxonomy term in the list. * @param $langcode * (optional) A language code to use for rendering. Defaults to the global * content language of the current request. @@ -819,7 +819,7 @@ function taxonomy_term_build_content($term, $view_mode = 'full', $langcode = NUL ); drupal_alter('entity_view_mode', $view_mode, $context); - // Try to add in the core taxonomy pieces like description and nodes. + // Add the term description if the term has one and it is visible. $type = 'taxonomy_term'; $entity_ids = entity_extract_ids($type, $term); $settings = field_view_mode_settings($type, $entity_ids[2]); @@ -869,7 +869,7 @@ function taxonomy_term_view($term, $view_mode = 'full', $langcode = NULL) { $langcode = $GLOBALS['language_content']->language; } - // Populate $node->content with a render() array. + // Populate $term->content with a render() array. taxonomy_term_build_content($term, $view_mode, $langcode); $build = $term->content; diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc index 4d2c4e6..563bb8c 100644 --- a/modules/taxonomy/taxonomy.pages.inc +++ b/modules/taxonomy/taxonomy.pages.inc @@ -33,17 +33,23 @@ function taxonomy_term_page($term) { drupal_set_breadcrumb($breadcrumb); drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name); - // If there is a menu link to this term, the link becomes the last part of - // the active trail, and the link name becomes the page title. Thus, we must - // explicitly set the page title to be the node title. - $uri = entity_uri('taxonomy_term', $term); - // Set the term path as the canonical URL to prevent duplicate content. + $uri = entity_uri('taxonomy_term', $term); drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); // Set the non-aliased path as a default shortlink. drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); - $build = taxonomy_term_show($term); + // Normally we would call taxonomy_term_show() here, but for backwards + // compatibility in Drupal 7 we do not want to do that (it produces different + // data structures and HTML markup than what Drupal 7 released with). Calling + // taxonomy_term_view() directly provides essentially the same thing, but + // allows us to wrap the rendered term in our desired array structure. + $build['term_heading'] = array( + '#prefix' => '
', + '#suffix' => '
', + 'term' => taxonomy_term_view($term, 'full'), + ); + if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) { $nodes = node_load_multiple($nids); $build += node_view_multiple($nodes);