Get list of bundles for entity programmatically

Public

Get bundles to populate option field for example.

Get raw version
php
  1. function get_entity_bundle_list($entity_type) {
  2. $entity_info = entity_get_info($entity_type);
  3. foreach($entity_info['bundles'] as $bundle_system_name => $bundle) {
  4. $entity_bundles[$bundle_system_name] = $bundle['label'];
  5. }
  6. return $entity_bundles;
  7. }