You are here

private function CustomBreadcrumbsForm::getEntityTypes in Custom Breadcrumbs 1.x

Get all available content entity types.

Return value

array Array of entity types.

1 call to CustomBreadcrumbsForm::getEntityTypes()
CustomBreadcrumbsForm::form in src/Form/CustomBreadcrumbsForm.php
Gets the actual form array to be built.

File

src/Form/CustomBreadcrumbsForm.php, line 287

Class

CustomBreadcrumbsForm
Custom breadcrumbs form.

Namespace

Drupal\custom_breadcrumbs\Form

Code

private function getEntityTypes() {
  $options = [];
  $options['_none'] = $this
    ->t('Select entity type');
  $types = $this->entityTypeManager
    ->getDefinitions();
  foreach ($types as $key => $type) {
    if ($type instanceof ContentEntityType && $type
      ->getLinkTemplates('canocical')) {
      $options[$key] = $type
        ->getLabel();
    }
  }
  return $options;
}