You are here

public static function EntityDefaultMetadataController::bundleOptionsList in Entity API 7

A options list callback returning all bundles for an entity type.

File

./entity.info.inc, line 121
Provides basic entity property info for entities provided via the CRUD API, as well as property info for all entity types defined by core. For that the respective modules/MODULE.info.inc files are included.

Class

EntityDefaultMetadataController
Default controller for generating some basic metadata for CRUD entity types.

Code

public static function bundleOptionsList($name, $info) {
  if (!empty($info['parent']) && ($type = $info['parent'])) {
    $entity_info = $info['parent']
      ->entityInfo();
    $options = array();
    foreach ($entity_info['bundles'] as $name => $bundle_info) {
      $options[$name] = $bundle_info['label'];
    }
    return $options;
  }
}