diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index f506fe5..22b92b4 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -276,13 +276,17 @@ public function preprocess(array &$variables) { } $variables['view_mode'] = $variables['elements']['#view_mode']; - $variables[$this->entityTypeId] = $variables['elements']['#' . $this->entityTypeId]; + $entity = $variables['elements']['#' . $this->entityTypeId];; + $variables[$this->entityTypeId] = $entity; + $variables['url'] = $entity->url(); // Helpful $content variable for templates. $variables += array('content' => array()); foreach (Element::children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; } + + $variables['attributes']['class'][] = $this->entityTypeId; } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 86936fe..a3777f8 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1477,7 +1477,6 @@ function template_preprocess_comment(&$variables) { } // Gather comment classes. - $variables['attributes']['class'][] = 'comment'; // 'published' class is not needed, it is either 'preview' or 'unpublished'. if ($variables['status'] != 'published') { $variables['attributes']['class'][] = $variables['status']; diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 98db55c..c71085d 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -643,7 +643,6 @@ function node_theme_suggestions_node(array $variables) { function template_preprocess_node(&$variables) { // Provide a distinct $teaser boolean. $variables['teaser'] = $variables['view_mode'] == 'teaser'; - $variables['node'] = $variables['elements']['#node']; /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; @@ -686,7 +685,6 @@ function template_preprocess_node(&$variables) { $variables['attributes']['role'] = 'article'; // Gather node classes. - $variables['attributes']['class'][] = 'node'; $variables['attributes']['class'][] = drupal_html_class('node-' . $node->bundle()); if ($node->isPromoted()) { $variables['attributes']['class'][] = 'promoted'; diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 4638e04..037225f 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -397,17 +397,14 @@ function taxonomy_theme_suggestions_taxonomy_term(array $variables) { */ function template_preprocess_taxonomy_term(&$variables) { /** @var \Drupal\taxonomy\TermInterface $term */ - $term = $variables['term']; + $term = $variables['taxonomy_term']; - $variables['url'] = $term->url(); // We use name here because that is what appears in the UI. $variables['name'] = check_plain($term->label()); $variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term); - // Gather classes, and clean up name so there are no underscores. - $variables['attributes']['class'][] = 'taxonomy-term'; - $vocabulary_name_css = str_replace('_', '-', $term->bundle()); - $variables['attributes']['class'][] = 'vocabulary-' . $vocabulary_name_css; + // Add a class for the vocabulary. + $variables['attributes']['class'][] = drupal_html_class('vocabulary-' . $term->bundle()); } /** diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig index a3986fa..5d39ba7 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.html.twig +++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig @@ -20,7 +20,7 @@ * For example, if the term belongs to a vocabulary called "Tags" then the * class would be "vocabulary-tags". * - page: Flag for the full page state. - * - term: The taxonomy term entity, including: + * - taxonomy_term: The taxonomy term entity, including: * - id: The ID of the taxonomy term. * - view_mode: View mode, e.g. 'full', 'teaser', etc. * @@ -29,7 +29,7 @@ * @ingroup themeable */ #} -
+
{{ title_prefix }} {% if not page %}

{{ name }}