Issue #1857336 by Xano, swentel, Berdir, InternetDevels: Use entity variable in $build for taxonomy_term entity.
parent
dc265f784f
commit
57aaddb41f
|
@ -37,19 +37,6 @@ class TermViewBuilder extends EntityViewBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langcode) {
|
|
||||||
$return = parent::getBuildDefaults($entity, $view_mode, $langcode);
|
|
||||||
|
|
||||||
// TODO: rename "term" to "taxonomy_term" in theme_taxonomy_term().
|
|
||||||
$return['#term'] = $return["#{$this->entityTypeId}"];
|
|
||||||
unset($return["#{$this->entityTypeId}"]);
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -372,7 +372,8 @@ function taxonomy_term_view_multiple(array $terms, $view_mode = 'full', $langcod
|
||||||
function taxonomy_theme_suggestions_taxonomy_term(array $variables) {
|
function taxonomy_theme_suggestions_taxonomy_term(array $variables) {
|
||||||
$suggestions = array();
|
$suggestions = array();
|
||||||
|
|
||||||
$term = $variables['elements']['#term'];
|
/** @var \Drupal\taxonomy\TermInterface $term */
|
||||||
|
$term = $variables['elements']['#taxonomy_term'];
|
||||||
|
|
||||||
$suggestions[] = 'taxonomy_term__' . $term->bundle();
|
$suggestions[] = 'taxonomy_term__' . $term->bundle();
|
||||||
$suggestions[] = 'taxonomy_term__' . $term->id();
|
$suggestions[] = 'taxonomy_term__' . $term->id();
|
||||||
|
@ -389,14 +390,15 @@ function taxonomy_theme_suggestions_taxonomy_term(array $variables) {
|
||||||
* An associative array containing:
|
* An associative array containing:
|
||||||
* - elements: An associative array containing the taxonomy term and any
|
* - elements: An associative array containing the taxonomy term and any
|
||||||
* fields attached to the term. Properties used:
|
* fields attached to the term. Properties used:
|
||||||
* - #term: The term object.
|
* - #taxonomy_term: A \Drupal\taxonomy\TermInterface object.
|
||||||
* - #view_mode: The current view mode for this taxonomy term, e.g.
|
* - #view_mode: The current view mode for this taxonomy term, e.g.
|
||||||
* 'full' or 'teaser'.
|
* 'full' or 'teaser'.
|
||||||
* - attributes: HTML attributes for the containing element.
|
* - attributes: HTML attributes for the containing element.
|
||||||
*/
|
*/
|
||||||
function template_preprocess_taxonomy_term(&$variables) {
|
function template_preprocess_taxonomy_term(&$variables) {
|
||||||
$variables['view_mode'] = $variables['elements']['#view_mode'];
|
$variables['view_mode'] = $variables['elements']['#view_mode'];
|
||||||
$variables['term'] = $variables['elements']['#term'];
|
$variables['term'] = $variables['elements']['#taxonomy_term'];
|
||||||
|
/** @var \Drupal\taxonomy\TermInterface $term */
|
||||||
$term = $variables['term'];
|
$term = $variables['term'];
|
||||||
|
|
||||||
$variables['url'] = $term->url();
|
$variables['url'] = $term->url();
|
||||||
|
|
Loading…
Reference in New Issue