You are here

public function MappingSteps::getEntityTypes in GatherContent 8.5

Get list of entity types.

Return value

array Assoc array of entity types.

1 call to MappingSteps::getEntityTypes()
MappingStepNew::getForm in gathercontent_ui/src/Form/MappingEditSteps/MappingStepNew.php
Returns form array.

File

gathercontent_ui/src/Form/MappingEditSteps/MappingSteps.php, line 622

Class

MappingSteps
Class MappingSteps.

Namespace

Drupal\gathercontent_ui\Form\MappingEditSteps

Code

public function getEntityTypes() {
  $entityTypes = \Drupal::entityTypeManager()
    ->getDefinitions();
  $unsupportedTypes = [
    'user',
    'file',
    'menu_link_content',
  ];
  $response = [];
  foreach ($entityTypes as $key => $value) {
    if ($value) {
      $class = $value
        ->getOriginalClass();
      if (in_array(FieldableEntityInterface::class, class_implements($class)) && !in_array($key, $unsupportedTypes)) {
        $label = (string) $value
          ->getLabel();
        $response[$key] = $label;
      }
    }
  }
  return $response;
}