From 435585012c75bd5073d36cf6e7500864c6332bf8 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 23 Oct 2010 15:30:34 +0000 Subject: #949576 by sun: Add missing hook_entity_view() and hook_entity_view_alter(). --- modules/taxonomy/taxonomy.api.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'modules/taxonomy/taxonomy.api.php') diff --git a/modules/taxonomy/taxonomy.api.php b/modules/taxonomy/taxonomy.api.php index 6ceab8f80..1527e487c 100644 --- a/modules/taxonomy/taxonomy.api.php +++ b/modules/taxonomy/taxonomy.api.php @@ -182,6 +182,34 @@ function hook_taxonomy_term_delete($term) { db_delete('term_synoynm')->condition('tid', $term->tid)->execute(); } +/** + * Alter the results of taxonomy_term_view(). + * + * This hook is called after the content has been assembled in a structured + * array and may be used for doing processing which requires that the complete + * taxonomy term content structure has been built. + * + * If the module wishes to act on the rendered HTML of the term rather than the + * structured content array, it may use this hook to add a #post_render + * callback. Alternatively, it could also implement + * hook_preprocess_taxonomy_term(). See drupal_render() and theme() + * documentation respectively for details. + * + * @param $build + * A renderable array representing the node content. + * + * @see hook_entity_view_alter() + */ +function hook_taxonomy_term_view_alter(&$build) { + if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) { + // Change its weight. + $build['an_additional_field']['#weight'] = -10; + } + + // Add a #post_render callback to act on the rendered HTML of the term. + $build['#post_render'][] = 'my_module_node_post_render'; +} + /** * @} End of "addtogroup hooks". */ -- cgit v1.2.3