Commit 2792a23b authored by webchick's avatar webchick

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

parent 1c519707
......@@ -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().
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment