You are here

public function DatasourcePluginBase::load in Search API 8

Loads an item.

Parameters

mixed $id: The datasource-specific ID of the item.

Return value

\Drupal\Core\TypedData\ComplexDataInterface|null The loaded item if it could be found, NULL otherwise.

Overrides DatasourceInterface::load

File

src/Datasource/DatasourcePluginBase.php, line 51

Class

DatasourcePluginBase
Defines a base class from which other datasources may extend.

Namespace

Drupal\search_api\Datasource

Code

public function load($id) {
  $items = $this
    ->loadMultiple([
    $id,
  ]);
  return $items ? reset($items) : NULL;
}