public function Index::isValidDatasource in Search API 8
Determines whether the given datasource ID is valid for this index.
The general contract of this method is that it should return TRUE if, and only if, a call to getDatasource() with the same ID would not result in an exception.
Parameters
string $datasource_id: A datasource plugin ID.
Return value
bool TRUE if the datasource with the given ID is enabled for this index and can be loaded. FALSE otherwise.
Overrides IndexInterface::isValidDatasource
1 call to Index::isValidDatasource()
- Index::preSave in src/
Entity/ Index.php - Acts on an entity before the presave hook is invoked.
File
- src/
Entity/ Index.php, line 356
Class
- Index
- Defines the search index configuration entity.
Namespace
Drupal\search_api\EntityCode
public function isValidDatasource($datasource_id) {
$datasources = $this
->getDatasources();
return !empty($datasources[$datasource_id]);
}