You are here

public function EntityExportCsvManager::getBundlesPerEntityType in Entity Export CSV 8

Gets the bundles of an entity type.

Parameters

string $entity_type_id: The entity type id.

bool $return_label: Should we return the array with the label as value ?

Return value

array An array of bundles.

Overrides EntityExportCsvManagerInterface::getBundlesPerEntityType

1 call to EntityExportCsvManager::getBundlesPerEntityType()
EntityExportCsvManager::getBundlesEnabledPerEntityType in src/EntityExportCsvManager.php
Gets the bundles enabled of an entity type.

File

src/EntityExportCsvManager.php, line 207

Class

EntityExportCsvManager
Class EntityExportCsvManager.

Namespace

Drupal\entity_export_csv

Code

public function getBundlesPerEntityType($entity_type_id, $return_label = FALSE) {
  $options = [];
  $bundles = $this->entityTypeBundleInfo
    ->getBundleInfo($entity_type_id);
  foreach ($bundles as $id => $bundle) {
    if ($return_label) {
      $options[$id] = $bundle['label'];
    }
    else {
      $options[$id] = $id;
    }
  }
  return $options;
}