Verified Commit b2109b4e authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3458183 by catch, Spokje: Deprecate $variables['teaser']

parent 54f16eb6
Loading
Loading
Loading
Loading
Loading
+4 −1
Changes for core/modules/node/node.module: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -476,8 +476,11 @@ function node_theme_suggestions_node(array $variables) {
 */
function template_preprocess_node(&$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  // Provide a distinct $teaser boolean.

  // The teaser variable is deprecated.
  $variables['deprecations']['teaser'] = "'teaser' is deprecated in drupal:11.1.0 and is removed in drupal:12.0.0. Use 'view_mode' instead. See https://www.drupal.org/node/3458185";
  $variables['teaser'] = $variables['view_mode'] == 'teaser';

  $variables['node'] = $variables['elements']['#node'];
  /** @var \Drupal\node\NodeInterface $node */
  $node = $variables['node'];
+0 −1
Changes for core/modules/node/templates/node.html.twig: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@
 * - title_suffix: Additional output populated by modules, intended to be
 *   displayed after the main title tag that appears in the template.
 * - view_mode: View mode; for example, "teaser" or "full".
 * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
 * - page: Flag for the full page state. Will be true if view_mode is 'full'.
 * - readmore: Flag for more state. Will be true if the teaser content of the
 *   node cannot hold the main body content.
+1 −1
Changes for core/themes/olivero/olivero.theme: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ function olivero_preprocess_maintenance_page(&$variables) {
function olivero_preprocess_node(&$variables) {
  // Remove the "Add new comment" link on teasers or when the comment form is
  // displayed on the page.
  if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) {
  if ($variables['view_mode'] === 'teaser' || !empty($variables['content']['comments']['comment_form'])) {
    unset($variables['content']['links']['comment']['#links']['comment-add']);
  }