function BlockContentBlock::__construct

Constructs a new BlockContentBlock.

Overrides BlockPluginTrait::__construct

File

core/modules/block_content/src/Plugin/Block/BlockContentBlock.php, line 41

Class

BlockContentBlock
Defines a generic block type.

Namespace

Drupal\block_content\Plugin\Block

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, protected BlockManagerInterface $blockManager, protected EntityTypeManagerInterface $entityTypeManager, protected AccountInterface $account, protected UrlGeneratorInterface $urlGenerator, protected BlockContentUuidLookup $uuidLookup, protected EntityDisplayRepositoryInterface $entityDisplayRepository, protected ?EntityRepositoryInterface $entityRepository = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  if (!$this->entityRepository instanceof EntityRepositoryInterface) {
    @trigger_error('Calling ' . __CLASS__ . ' constructor without the $entityRepository argument is deprecated in drupal:11.3.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/project/drupal/issues/3175985', E_USER_DEPRECATED);
    $this->entityRepository = \Drupal::service(EntityRepositoryInterface::class);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.