You are here

public function CreateTemplateForm::getEntityTypes in GatherContent 8.5

Get list of entity types.

Return value

array Assoc array of entity types.

1 call to CreateTemplateForm::getEntityTypes()
CreateTemplateForm::buildForm in gathercontent_upload_ui/src/Form/CreateTemplateForm.php
Form constructor.

File

gathercontent_upload_ui/src/Form/CreateTemplateForm.php, line 183

Class

CreateTemplateForm

Namespace

Drupal\gathercontent_upload_ui\Form

Code

public function getEntityTypes() {
  $entityTypes = $this->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;
}