Skip to content
Snippets Groups Projects
Commit 2792a23b authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1067120 follow-up by DamienMcKenna: API docs for hook_taxonomy_term_view().

parent 1c519707
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -224,6 +224,30 @@ function hook_taxonomy_term_delete(Drupal\taxonomy\Term $term) {
db_delete('term_synoynm')->condition('tid', $term->tid)->execute();
}
/**
* 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().
*
* @param $term
* The term that is being assembled for rendering.
* @param $view_mode
* The $view_mode parameter from taxonomy_term_view().
* @param $langcode
* The language code used for rendering.
*
* @see hook_entity_view()
*/
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',
);
}
/**
* Alter the results of taxonomy_term_view().
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment