You are here

public function PageEventVariables::getNode in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/src/Variables/PageEventVariables.php \Drupal\preprocess_event_dispatcher\Variables\PageEventVariables::getNode()

Get the node of the page.

Return value

\Drupal\node\NodeInterface|null Drupal node.

File

modules/preprocess_event_dispatcher/src/Variables/PageEventVariables.php, line 28

Class

PageEventVariables
Class PageEventVariables.

Namespace

Drupal\preprocess_event_dispatcher\Variables

Code

public function getNode() : ?NodeInterface {
  if (!$this
    ->isNodePage()) {
    return NULL;
  }
  return $this->variables['node'];
}