public function ContentEntity::getItemLabel in Search API 8
Retrieves a human-readable label for an item.
Parameters
\Drupal\Core\TypedData\ComplexDataInterface $item: An item of this controller's type.
Return value
string|null Either a human-readable label for the item, or NULL if none is available.
Overrides DatasourcePluginBase::getItemLabel
File
- src/
Plugin/ search_api/ datasource/ ContentEntity.php, line 690
Class
- ContentEntity
- Represents a datasource which exposes the content entities.
Namespace
Drupal\search_api\Plugin\search_api\datasourceCode
public function getItemLabel(ComplexDataInterface $item) {
if ($entity = $this
->getEntity($item)) {
return $entity
->label();
}
return NULL;
}