You are here

public function Index::removeDatasource in Search API 8

Removes a datasource from this index.

Parameters

string $datasource_id: The ID of the datasource to remove.

Return value

$this

Overrides IndexInterface::removeDatasource

File

src/Entity/Index.php, line 392

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function removeDatasource($datasource_id) {

  // Make sure the datasourceInstances are loaded before trying to remove a
  // plugin from them.
  if ($this->datasourceInstances === NULL) {
    $this
      ->getDatasources();
  }
  unset($this->datasourceInstances[$datasource_id]);
  return $this;
}