template_preprocess_taxonomy_term(&$variables)
Prepares variables for taxonomy term templates.
Default template: taxonomy-term.html.twig.
array $variables: An associative array containing:
function template_preprocess_taxonomy_term(&$variables) { $variables['view_mode'] = $variables['elements']['#view_mode']; $variables['term'] = $variables['elements']['#taxonomy_term']; /** @var \Drupal\taxonomy\TermInterface $term */ $term = $variables['term']; $variables['url'] = $term->url(); // We use name here because that is what appears in the UI. $variables['name'] = $variables['elements']['name']; unset($variables['elements']['name']); $variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term); // Helpful $content variable for templates. $variables['content'] = array(); foreach (Element::children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!taxonomy!taxonomy.module/function/template_preprocess_taxonomy_term/8.1.x