You are here

public function NodeViewController::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/src/Controller/NodeViewController.php \Drupal\node\Controller\NodeViewController::__construct()

Creates a NodeViewController object.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Render\RendererInterface $renderer: The renderer service.

\Drupal\Core\Session\AccountInterface $current_user: The current user.

\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.

Overrides EntityViewController::__construct

File

core/modules/node/src/Controller/NodeViewController.php, line 44

Class

NodeViewController
Defines a controller to render a single node.

Namespace

Drupal\node\Controller

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, AccountInterface $current_user, EntityRepositoryInterface $entity_repository) {
  parent::__construct($entity_type_manager, $renderer);
  $this->currentUser = $current_user;
  $this->entityRepository = $entity_repository;
}