function template_preprocess_taxonomy_term
Same name and namespace in other branches
- 10 core/modules/taxonomy/taxonomy.module \template_preprocess_taxonomy_term()
- 9 core/modules/taxonomy/taxonomy.module \template_preprocess_taxonomy_term()
- 8.9.x core/modules/taxonomy/taxonomy.module \template_preprocess_taxonomy_term()
- 7.x modules/taxonomy/taxonomy.module \template_preprocess_taxonomy_term()
Prepares variables for taxonomy term templates.
Default template: taxonomy-term.html.twig.
By default this function performs special preprocessing to move the name base field out of the elements array into a separate variable. This preprocessing is skipped if:
- a module makes the field's display configurable via the field UI by means of BaseFieldDefinition::setDisplayConfigurable()
- AND the additional entity type property 'enable_base_field_custom_preprocess_skipping' has been set using hook_entity_type_build().
Parameters
array $variables: An associative array containing:
- elements: An associative array containing the taxonomy term and any
fields attached to the term. Properties used:
- #taxonomy_term: A \Drupal\taxonomy\TermInterface object.
- #view_mode: The current view mode for this taxonomy term, e.g. 'full' or 'teaser'.
- attributes: HTML attributes for the containing element.
Deprecated
in drupal:11.3.0 and is removed from drupal:13.0.0. Use \Drupal::service(TaxonomyThemeHooks::class)->preprocessTaxonomyTerm($variables) instead.
See also
https://www.drupal.org/node/3542527
File
-
core/
modules/ taxonomy/ taxonomy.module, line 38
Code
function template_preprocess_taxonomy_term(&$variables) : void {
@trigger_error(__FUNCTION__ . ' is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. Use \\Drupal::service(TaxonomyThemeHooks::class)->preprocessTaxonomyTerm($variables); instead. See https://www.drupal.org/node/3542527', E_USER_DEPRECATED);
\Drupal::service(TaxonomyThemeHooks::class)->preprocessTaxonomyTerm($variables);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.