function ContentPreprocess::isLatestVersionPage

Same name in other branches
  1. 9 core/modules/content_moderation/src/ContentPreprocess.php \Drupal\content_moderation\ContentPreprocess::isLatestVersionPage()
  2. 8.9.x core/modules/content_moderation/src/ContentPreprocess.php \Drupal\content_moderation\ContentPreprocess::isLatestVersionPage()
  3. 11.x core/modules/content_moderation/src/ContentPreprocess.php \Drupal\content_moderation\ContentPreprocess::isLatestVersionPage()

Checks whether a route is the "Latest version" tab of a node.

Parameters

\Drupal\node\Entity\Node $node: A node.

Return value

bool True if the current route is the latest version tab of the given node.

1 call to ContentPreprocess::isLatestVersionPage()
ContentPreprocess::preprocessNode in core/modules/content_moderation/src/ContentPreprocess.php

File

core/modules/content_moderation/src/ContentPreprocess.php, line 64

Class

ContentPreprocess
Determines whether a route is the "Latest version" tab of a node.

Namespace

Drupal\content_moderation

Code

public function isLatestVersionPage(Node $node) {
    return $this->routeMatch
        ->getRouteName() == 'entity.node.latest_version' && ($pageNode = $this->routeMatch
        ->getParameter('node')) && $pageNode->id() == $node->id();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.