You are here

public function ContentEntity::__construct in Search API 8

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 IndexPluginBase::__construct

File

src/Plugin/search_api/datasource/ContentEntity.php, line 141

Class

ContentEntity
Represents a datasource which exposes the content entities.

Namespace

Drupal\search_api\Plugin\search_api\datasource

Code

public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
  if (($configuration['#index'] ?? NULL) instanceof IndexInterface) {
    $this
      ->setIndex($configuration['#index']);
    unset($configuration['#index']);
  }

  // Since defaultConfiguration() depends on the plugin definition, we need to
  // override the constructor and set the definition property before calling
  // that method.
  $this->pluginDefinition = $plugin_definition;
  $this->pluginId = $plugin_id;
  $this->configuration = $configuration + $this
    ->defaultConfiguration();
}