You are here

public function ContentEntity::getItemBundle in Search API 8

Retrieves the item's bundle.

Parameters

\Drupal\Core\TypedData\ComplexDataInterface $item: An item of this datasource's type.

Return value

string The bundle identifier of the item. Might be just the datasource identifier or a similar pseudo-bundle if the datasource does not contain any bundles.

Overrides DatasourcePluginBase::getItemBundle

See also

getBundles()

File

src/Plugin/search_api/datasource/ContentEntity.php, line 700

Class

ContentEntity
Represents a datasource which exposes the content entities.

Namespace

Drupal\search_api\Plugin\search_api\datasource

Code

public function getItemBundle(ComplexDataInterface $item) {
  if ($entity = $this
    ->getEntity($item)) {
    return $entity
      ->bundle();
  }
  return NULL;
}