public function Item::getDatasource in Search API 8
Returns the datasource of this item.
Return value
\Drupal\search_api\Datasource\DatasourceInterface The datasource to which this item belongs.
Throws
\Drupal\search_api\SearchApiException Thrown if the item's datasource wasn't set before and couldn't be loaded.
Overrides ItemInterface::getDatasource
File
- src/
Item/ Item.php, line 159
Class
- Item
- Provides a default implementation for a search item.
Namespace
Drupal\search_api\ItemCode
public function getDatasource() {
if (!isset($this->datasource)) {
$this->datasource = $this->index
->getDatasource($this
->getDatasourceId());
}
return $this->datasource;
}