protected function EntityTypeInfo::getModeratedBundles in Workbench Moderation 8.2
Same name and namespace in other branches
- 8 src/EntityTypeInfo.php \Drupal\workbench_moderation\EntityTypeInfo::getModeratedBundles()
Returns an iterable list of entity names and bundle names under moderation.
That is, this method returns a list of bundles that have Workbench Moderation enabled on them.
Return value
\Generator A generator, yielding a 2 element associative array:
- entity: The machine name of an entity, such as "node" or "block_content".
- bundle: The machine name of a bundle, such as "page" or "article".
1 call to EntityTypeInfo::getModeratedBundles()
- EntityTypeInfo::entityExtraFieldInfo in src/
EntityTypeInfo.php - Gets the "extra fields" for a bundle.
File
- src/
EntityTypeInfo.php, line 232
Class
- EntityTypeInfo
- Service class for manipulating entity type information.
Namespace
Drupal\workbench_moderationCode
protected function getModeratedBundles() {
$revisionable_types = $this->moderationInfo
->selectRevisionableEntityTypes($this->entityTypeManager
->getDefinitions());
/** @var ConfigEntityTypeInterface $type */
foreach ($revisionable_types as $type_name => $type) {
$result = $this->entityTypeManager
->getStorage($type_name)
->getQuery()
->condition('third_party_settings.workbench_moderation.enabled', TRUE)
->execute();
foreach ($result as $bundle_name) {
(yield [
'entity' => $type
->getBundleOf(),
'bundle' => $bundle_name,
]);
}
}
}