You are here

public function BackgroundImageManager::getEnabledEntityTypes in Background Image 2.0.x

Same name and namespace in other branches
  1. 8 src/BackgroundImageManager.php \Drupal\background_image\BackgroundImageManager::getEnabledEntityTypes()
  2. 2.x src/BackgroundImageManager.php \Drupal\background_image\BackgroundImageManager::getEnabledEntityTypes()

Retrieves the enabled entity types.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] An associative array of EntityTypeInterface objects, keyed by their machine name.

Overrides BackgroundImageManagerInterface::getEnabledEntityTypes

1 call to BackgroundImageManager::getEnabledEntityTypes()
BackgroundImageManager::validEntity in src/BackgroundImageManager.php
Checks whether an entity can use background images.

File

src/BackgroundImageManager.php, line 394

Class

BackgroundImageManager

Namespace

Drupal\background_image

Code

public function getEnabledEntityTypes() {
  $supported = $this
    ->getSupportedEntityTypes();
  $enabled = [];
  foreach ($supported as $entity_type) {
    if (array_filter($this
      ->getEnabledEntityTypeBundles($entity_type))) {
      $enabled[$entity_type
        ->id()] = TRUE;
    }
  }
  return array_intersect_key($supported, $enabled);
}