W3cubDocs

/Drupal 8

function entity_get_bundles

entity_get_bundles($entity_type = NULL)

Returns the entity bundle info.

Parameters

string|null $entity_type: The entity type whose bundle info should be returned, or NULL for all bundles info. Defaults to NULL.

Return value

array The bundle info for a specific entity type, or all entity types.

Deprecated

in Drupal 8.x-dev and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getBundleInfo() for a single bundle, or \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getAllBundleInfo() for all bundles.

See also

\Drupal\Core\Entity\EntityTypeBundleInfoInterface::getBundleInfo()

\Drupal\Core\Entity\EntityTypeBundleInfoInterface::getAllBundleInfo()

File

core/includes/entity.inc, line 43
Entity API for handling entities like nodes or users.

Code

function entity_get_bundles($entity_type = NULL) {
  if (isset($entity_type)) {
    return \Drupal::entityManager()->getBundleInfo($entity_type);
  }
  else {
    return \Drupal::entityManager()->getAllBundleInfo();
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!entity.inc/function/entity_get_bundles/8.1.x