You are here

public function Field::setDatasourceId in Search API 8

Sets the ID of this field's datasource.

Parameters

string|null $datasource_id: The plugin ID of this field's datasource, or NULL if the field is datasource-independent.

Return value

$this

Overrides FieldInterface::setDatasourceId

File

src/Item/Field.php, line 350

Class

Field
Represents a field on a search item that can be indexed.

Namespace

Drupal\search_api\Item

Code

public function setDatasourceId($datasource_id) {
  if ($this->datasourceId != $datasource_id) {
    $this->datasource = NULL;
  }
  $this->datasourceId = $datasource_id;
  return $this;
}