protected function ContentEntity::getEntity in Search API 8
Retrieves the entity from a search item.
Parameters
\Drupal\Core\TypedData\ComplexDataInterface $item: An item of this datasource's type.
Return value
\Drupal\Core\Entity\EntityInterface|null The entity object represented by that item, or NULL if none could be found.
7 calls to ContentEntity::getEntity()
- ContentEntity::getItemAccessResult in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Checks whether a user has permission to view the given item.
- ContentEntity::getItemBundle in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Retrieves the item's bundle.
- ContentEntity::getItemId in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Retrieves the unique ID of an object from this datasource.
- ContentEntity::getItemLabel in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Retrieves a human-readable label for an item.
- ContentEntity::getItemUrl in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Retrieves a URL at which the item can be viewed on the web.
File
- src/
Plugin/ search_api/ datasource/ ContentEntity.php, line 669
Class
- ContentEntity
- Represents a datasource which exposes the content entities.
Namespace
Drupal\search_api\Plugin\search_api\datasourceCode
protected function getEntity(ComplexDataInterface $item) {
$value = $item
->getValue();
return $value instanceof EntityInterface ? $value : NULL;
}