Unverified Commit a997779d authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3142857 by mherchel, sulfikar_s, anmolgoyal74, kostyashupenko, Abhijith...

Issue #3142857 by mherchel, sulfikar_s, anmolgoyal74, kostyashupenko, Abhijith S, proeung, DuneBL: Refactor Olivero's usage of layout CSS class in node--article--full
parent 84b1d18b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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';
  }
}

/**
+0 −11
Original line number Diff line number Diff line
{#
/**
 * @file
 * Olivero's theme implementation for an article content type's full view mode.
 */
 #}
{% include '@olivero/content/node.html.twig' with
  {
    'layout': 'content-narrow',
  }
%}