You are here

public function ChooseBlockController::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Controller/ChooseBlockController.php \Drupal\layout_builder\Controller\ChooseBlockController::__construct()

ChooseBlockController constructor.

Parameters

\Drupal\Core\Block\BlockManagerInterface $block_manager: The block manager.

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

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

File

core/modules/layout_builder/src/Controller/ChooseBlockController.php, line 61

Class

ChooseBlockController
Defines a controller to choose a new block.

Namespace

Drupal\layout_builder\Controller

Code

public function __construct(BlockManagerInterface $block_manager, EntityTypeManagerInterface $entity_type_manager, AccountInterface $current_user = NULL) {
  $this->blockManager = $block_manager;
  $this->entityTypeManager = $entity_type_manager;
  if (!$current_user) {
    @trigger_error('The current_user service must be passed to ChooseBlockController::__construct(), it is required before Drupal 9.0.0.', E_USER_DEPRECATED);
    $current_user = \Drupal::currentUser();
  }
  $this->currentUser = $current_user;
}