You are here

public function EntityExportCsvManager::getContentEntityTypesEnabled in Entity Export CSV 8

Returns an array of content entity types ID enabled.

Parameters

bool $return_label: Return an array with the label as value.

Return value

array An array of entity type id enabled.

Overrides EntityExportCsvManagerInterface::getContentEntityTypesEnabled

File

src/EntityExportCsvManager.php, line 187

Class

EntityExportCsvManager
Class EntityExportCsvManager.

Namespace

Drupal\entity_export_csv

Code

public function getContentEntityTypesEnabled($return_label = FALSE) {
  $entity_types = [];
  $entity_type_settings = $this->configFactory
    ->get('entity_export_csv.settings')
    ->get('entity_types');
  foreach ($entity_type_settings as $entity_type_id => $value) {
    if ($value['enable']) {
      if ($return_label) {
        $label = $this->entityTypeManager
          ->getStorage($entity_type_id)
          ->getEntityType()
          ->getLabel();
        $entity_types[$entity_type_id] = $label;
      }
      else {
        $entity_types[$entity_type_id] = $entity_type_id;
      }
    }
  }
  return $entity_types;
}