You are here

public function FieldsHelper::createItem in Search API 8

Creates a search item object.

Parameters

\Drupal\search_api\IndexInterface $index: The item's search index.

string $id: The item's (combined) ID.

\Drupal\search_api\Datasource\DatasourceInterface|null $datasource: (optional) The datasource of the item. If not set, it will be determined from the ID and loaded from the index if needed.

Return value

\Drupal\search_api\Item\ItemInterface A search item with the given values.

Overrides FieldsHelperInterface::createItem

1 call to FieldsHelper::createItem()
FieldsHelper::createItemFromObject in src/Utility/FieldsHelper.php
Creates a search item object by wrapping an existing complex data object.

File

src/Utility/FieldsHelper.php, line 408

Class

FieldsHelper
Provides helper methods for dealing with Search API fields and properties.

Namespace

Drupal\search_api\Utility

Code

public function createItem(IndexInterface $index, $id, DatasourceInterface $datasource = NULL) {
  return new Item($index, $id, $datasource);
}