You are here

public function FieldInheritancePluginBase::__construct in Field Inheritance 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/FieldInheritance/FieldInheritancePluginBase.php \Drupal\field_inheritance\Plugin\FieldInheritance\FieldInheritancePluginBase::__construct()

Constructs a FieldInheritancePluginBase object.

Parameters

array $configuration: The plugin configuration.

string $plugin_id: The plugin ID.

mixed $plugin_definition: The plugin definition.

Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager service.

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

Drupal\Core\KeyValueStore\KeyValueFactory $key_value: The key value store.

Overrides PluginBase::__construct

File

src/Plugin/FieldInheritance/FieldInheritancePluginBase.php, line 104

Class

FieldInheritancePluginBase
Abstract class FieldInheritancePluginBase.

Namespace

Drupal\field_inheritance\Plugin\FieldInheritance

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, LanguageManagerInterface $language_manager, EntityTypeManager $entity_type_manager, KeyValueFactory $key_value) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->fieldInheritanceId = $configuration['id'];
  $this->entity = $configuration['entity'];
  $this->method = $configuration['method'];
  $this->sourceEntityType = $configuration['source entity type'];
  $this->sourceField = $configuration['source field'];
  if (!empty($configuration['destination field'])) {
    $this->destinationField = $configuration['destination field'];
  }
  $this->languageManager = $language_manager;
  $this->langCode = $this->languageManager
    ->getCurrentLanguage()
    ->getId();
  $this->entityTypeManager = $entity_type_manager;
  $this->keyValue = $key_value;
}