public function Field::getDatasource in Search API 8
Returns the datasource of this field.
Return value
\Drupal\search_api\Datasource\DatasourceInterface|null The datasource to which this field belongs. NULL if the field is datasource-independent.
Throws
\Drupal\search_api\SearchApiException Thrown if the field's datasource couldn't be loaded.
Overrides FieldInterface::getDatasource
File
- src/
Item/ Field.php, line 340
Class
- Field
- Represents a field on a search item that can be indexed.
Namespace
Drupal\search_api\ItemCode
public function getDatasource() {
if (!isset($this->datasource) && isset($this->datasourceId)) {
$this->datasource = $this
->getIndex()
->getDatasource($this->datasourceId);
}
return $this->datasource;
}