You are here

public function EntityExportCsvManager::getSupportedContentEntityTypes in Entity Export CSV 8

Returns objects or id of content entity types supported.

Parameters

bool $return_object: Should we return an array of object ?

Return value

array Id or Objects of entity types supported.

Overrides EntityExportCsvManagerInterface::getSupportedContentEntityTypes

File

src/EntityExportCsvManager.php, line 167

Class

EntityExportCsvManager
Class EntityExportCsvManager.

Namespace

Drupal\entity_export_csv

Code

public function getSupportedContentEntityTypes($return_object = TRUE) {

  /** @var \Drupal\Core\Entity\ContentEntityTypeInterface[] $entity_types */
  $entity_types = $this->entityTypeManager
    ->getDefinitions();
  foreach ($entity_types as $entity_type_id => $entity_type) {
    if (!$entity_type instanceof ContentEntityTypeInterface) {
      unset($entity_types[$entity_type_id]);
      continue;
    }
  }
  if ($return_object) {
    return $entity_types;
  }
  else {
    return array_keys($entity_types);
  }
}