You are here

public function InlineBlock::__construct in Drupal 8

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

Constructs a new InlineBlock.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

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

\Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository: The entity display repository.

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

Overrides BlockPluginTrait::__construct

File

core/modules/layout_builder/src/Plugin/Block/InlineBlock.php, line 87

Class

InlineBlock
Defines an inline block plugin type.

Namespace

Drupal\layout_builder\Plugin\Block

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository, AccountInterface $current_user = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->entityTypeManager = $entity_type_manager;
  $this->entityDisplayRepository = $entity_display_repository;
  if (!empty($this->configuration['block_revision_id']) || !empty($this->configuration['block_serialized'])) {
    $this->isNew = FALSE;
  }
  if (!$current_user) {
    @trigger_error('The current_user service must be passed to InlineBlock::__construct(), it is required before Drupal 9.0.0.', E_USER_DEPRECATED);
    $current_user = \Drupal::currentUser();
  }
  $this->currentUser = $current_user;
}