You are here

public function ScheduledTransitionsUtility::getApplicableBundles in Scheduled Transitions 2.x

Same name and namespace in other branches
  1. 8 src/ScheduledTransitionsUtility.php \Drupal\scheduled_transitions\ScheduledTransitionsUtility::getApplicableBundles()

Get list of entity type/bundles scheduled transitions can work with.

Return value

array Arrays of bundles keyed by entity type.

Overrides ScheduledTransitionsUtilityInterface::getApplicableBundles

1 call to ScheduledTransitionsUtility::getApplicableBundles()
ScheduledTransitionsUtility::getBundles in src/ScheduledTransitionsUtility.php
Get list of entity type/bundles scheduled transitions are enabled on.

File

src/ScheduledTransitionsUtility.php, line 128

Class

ScheduledTransitionsUtility
Utilities for Scheduled Transitions module.

Namespace

Drupal\scheduled_transitions

Code

public function getApplicableBundles() : array {
  $bundles = [];
  $bundleInfo = $this->bundleInfo
    ->getAllBundleInfo();
  foreach ($bundleInfo as $entityTypeId => $entityTypeBundles) {
    $entityType = $this->entityTypeManager
      ->getDefinition($entityTypeId);
    $entityTypeBundles = array_filter($entityTypeBundles, function ($bundleId) use ($entityType) : bool {
      return $this->moderationInformation
        ->shouldModerateEntitiesOfBundle($entityType, $bundleId);
    }, \ARRAY_FILTER_USE_KEY);
    $bundles[$entityTypeId] = array_keys($entityTypeBundles);
  }
  return array_filter($bundles);
}