You are here

public function ParagraphBlock::__construct in Paragraph blocks 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Block/ParagraphBlock.php \Drupal\paragraph_blocks\Plugin\Block\ParagraphBlock::__construct()
  2. 3.x src/Plugin/Block/ParagraphBlock.php \Drupal\paragraph_blocks\Plugin\Block\ParagraphBlock::__construct()

Constructs a new ParagraphBlock.

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.

Overrides BlockPluginTrait::__construct

File

src/Plugin/Block/ParagraphBlock.php, line 64

Class

ParagraphBlock
Provides a block to a paragraph value on an entity.

Namespace

Drupal\paragraph_blocks\Plugin\Block

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
  $this->entityTypeManager = $entity_type_manager;

  // Get the field delta from the plugin.
  list(, $entity_type_id, $field_name, $field_delta) = explode(':', $plugin_id);
  $this->entityTypeId = $entity_type_id;
  $this->fieldName = $field_name;
  $this->fieldDelta = $field_delta;
  parent::__construct($configuration, $plugin_id, $plugin_definition);
}