You are here

public function BundlePluginHandler::getBundleInfo in Entity API 8

Gets the bundle info.

Return value

array An array of bundle information keyed by the bundle name. The format expected by hook_entity_bundle_info().

Overrides BundlePluginHandlerInterface::getBundleInfo

File

src/BundlePlugin/BundlePluginHandler.php, line 51

Class

BundlePluginHandler

Namespace

Drupal\entity\BundlePlugin

Code

public function getBundleInfo() {
  $bundles = [];
  foreach ($this->pluginManager
    ->getDefinitions() as $plugin_id => $definition) {
    $bundles[$plugin_id] = [
      'label' => $definition['label'],
      'description' => isset($definition['description']) ? $definition['description'] : '',
      'translatable' => $this->entityType
        ->isTranslatable(),
      'provider' => $definition['provider'],
    ];
  }
  return $bundles;
}