You are here

private function PageContext::setNodeData in Acquia Lift Connector 8

Same name and namespace in other branches
  1. 8.4 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::setNodeData()
  2. 8.3 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::setNodeData()

Set Node data.

Parameters

\Drupal\Core\Entity\EntityInterface $node: Node.

1 call to PageContext::setNodeData()
PageContext::setByNode in src/Service/Context/PageContext.php
Set page context by node.

File

src/Service/Context/PageContext.php, line 96
Contains \Drupal\acquia_lift\Service\Context\PageContext.

Class

PageContext

Namespace

Drupal\acquia_lift\Service\Context

Code

private function setNodeData(EntityInterface $node) {
  $this->pageContext['content_type'] = $node
    ->getType();
  $this->pageContext['content_title'] = $node
    ->getTitle();
  $this->pageContext['published_date'] = $node
    ->getCreatedTime();
  $this->pageContext['post_id'] = $node
    ->id();
  $this->pageContext['author'] = $node
    ->getOwner()
    ->getUsername();
  $this->pageContext['page_type'] = 'node page';
}