function hook_taxonomy_term_view

Act on a taxonomy term that is being assembled before rendering.

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().

Parameters

$term: The term that is being assembled for rendering.

$view_mode: The $view_mode parameter from taxonomy_term_view().

$langcode: The language code used for rendering.

See also

hook_entity_view()

Related topics

1 function implements hook_taxonomy_term_view()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

taxonomy_test_taxonomy_term_view in modules/simpletest/tests/taxonomy_test.module
Implements hook_taxonomy_term_view().
1 invocation of hook_taxonomy_term_view()
taxonomy_term_build_content in modules/taxonomy/taxonomy.module
Builds a structured array representing the term's content.

File

modules/taxonomy/taxonomy.api.php, line 193

Code

function hook_taxonomy_term_view($term, $view_mode, $langcode) {
    $term->content['my_additional_field'] = array(
        '#markup' => $additional_field,
        '#weight' => 10,
        '#theme' => 'mymodule_my_additional_field',
    );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.