You are here

public function PageEventVariables::getNode in Hook Event Dispatcher 8

Get the node of the page.

Return value

\Drupal\node\NodeInterface|null Drupal node.

File

src/Event/Preprocess/Variables/PageEventVariables.php, line 28

Class

PageEventVariables
Class PageEventVariables.

Namespace

Drupal\hook_event_dispatcher\Event\Preprocess\Variables

Code

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