From a997779d33c8d28d155e3971f1dcd65d1f1aea12 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 8 Dec 2020 16:35:32 +0000
Subject: [PATCH] Issue #3142857 by mherchel, sulfikar_s, anmolgoyal74,
 kostyashupenko, Abhijith S, proeung, DuneBL: Refactor Olivero's usage of
 layout CSS class in node--article--full

---
 core/themes/olivero/olivero.theme                     |  7 +++++++
 .../templates/content/node--article--full.html.twig   | 11 -----------
 2 files changed, 7 insertions(+), 11 deletions(-)
 delete mode 100644 core/themes/olivero/templates/content/node--article--full.html.twig

diff --git a/core/themes/olivero/olivero.theme b/core/themes/olivero/olivero.theme
index 1c2e9a7b5352..38ae150e7afd 100644
--- a/core/themes/olivero/olivero.theme
+++ b/core/themes/olivero/olivero.theme
@@ -100,6 +100,13 @@ function olivero_preprocess_node(&$variables) {
   if (!empty($variables['date']) && !empty($variables['display_submitted']) && $variables['display_submitted'] === TRUE) {
     $variables['date'] = \Drupal::service('date.formatter')->format($variables['node']->getCreatedTime(), 'olivero_medium');
   }
+
+  // Pass layout variable to template if content type is article in full view
+  // mode. This is then used in the template to create a BEM style CSS class to
+  // control the layout.
+  if ($variables['node']->bundle() === 'article' && $variables['view_mode'] === 'full') {
+    $variables['layout'] = 'content-narrow';
+  }
 }
 
 /**
diff --git a/core/themes/olivero/templates/content/node--article--full.html.twig b/core/themes/olivero/templates/content/node--article--full.html.twig
deleted file mode 100644
index 55c0ae9db182..000000000000
--- a/core/themes/olivero/templates/content/node--article--full.html.twig
+++ /dev/null
@@ -1,11 +0,0 @@
-{#
-/**
- * @file
- * Olivero's theme implementation for an article content type's full view mode.
- */
- #}
-{% include '@olivero/content/node.html.twig' with
-  {
-    'layout': 'content-narrow',
-  }
-%}
-- 
GitLab