You are here

public function UnsavedIndexConfiguration::addDatasource in Search API 8

Adds a datasource to this index.

An existing datasource with the same ID will be replaced.

Parameters

\Drupal\search_api\Datasource\DatasourceInterface $datasource: The datasource to be added.

Return value

$this

Overrides IndexInterface::addDatasource

File

src/UnsavedIndexConfiguration.php, line 269

Class

UnsavedIndexConfiguration
Represents a configuration of an index that was not yet permanently saved.

Namespace

Drupal\search_api

Code

public function addDatasource(DatasourceInterface $datasource) {
  $this->entity
    ->addDatasource($datasource);
  return $this;
}