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();
  }
}
doc_Drupal
2016-10-29 09:09:14
Comments
Leave a Comment

Please login to continue.