You are here

public function EntityMatcher::__construct in Linkit 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/Linkit/Matcher/EntityMatcher.php \Drupal\linkit\Plugin\Linkit\Matcher\EntityMatcher::__construct()

Constructs a \Drupal\Component\Plugin\PluginBase object.

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.

Overrides MatcherBase::__construct

File

src/Plugin/Linkit/Matcher/EntityMatcher.php, line 70
Contains \Drupal\linkit\Plugin\Linkit\Matcher\EntityMatcher.

Class

EntityMatcher
Plugin annotation @Matcher( id = "entity", label = @Translation("Entity"), deriver = "\Drupal\linkit\Plugin\Derivative\EntityMatcherDeriver" )

Namespace

Drupal\linkit\Plugin\Linkit\Matcher

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $database, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  if (empty($plugin_definition['target_entity'])) {
    throw new \InvalidArgumentException("Missing required 'target_entity' property for a matcher.");
  }
  $this->database = $database;
  $this->entityManager = $entity_manager;
  $this->moduleHandler = $module_handler;
  $this->currentUser = $current_user;
  $this->target_type = $plugin_definition['target_entity'];
}