You are here

function _search_api_views_get_bundle_names in Search API 8

Returns an options list for bundles of the given entity type.

Parameters

string $entity_type_id: The entity type for which to retrieve the bundle names.

Return value

array An array of allowed values, mapping bundle keys to their (translated) identifiers.

See also

_search_api_views_handler_adjustments()

1 string reference to '_search_api_views_get_bundle_names'
_search_api_views_handler_adjustments in ./search_api.views.inc
Makes necessary, field-specific adjustments to Views handler definitions.

File

./search_api.module, line 515
Provides a rich framework for creating searches.

Code

function _search_api_views_get_bundle_names(string $entity_type_id) {
  $bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo($entity_type_id);
  return array_map(function ($bundle_info) {
    return $bundle_info['label'];
  }, $bundles);
}