You are here

public function EntityManager::getContentHubEnabledEntityTypeIds in Acquia Content Hub 8

Returns the list of enabled entity types for Content Hub.

Return value

string[] A list of enabled entity type IDs.

File

src/EntityManager.php, line 658

Class

EntityManager
Provides a service for managing entity actions for Content Hub.

Namespace

Drupal\acquia_contenthub

Code

public function getContentHubEnabledEntityTypeIds() {

  /** @var \Drupal\acquia_contenthub\Entity\ContentHubEntityTypeConfig[] $entity_type_ids */
  $entity_type_ids = $this
    ->getContentHubEntityTypeConfigurationEntities();
  $enabled_entity_type_ids = [];
  foreach ($entity_type_ids as $entity_type_id => $entity_type_config) {
    $bundles = $entity_type_config
      ->getBundles();

    // For a type to be enabled, it must at least have one bundle enabled.
    if (!empty(array_filter(array_column($bundles, 'enable_index')))) {
      $enabled_entity_type_ids[] = $entity_type_id;
    }
  }
  return $enabled_entity_type_ids;
}