protected 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 Content Moderation enabled on them.
Return value
\Generator A generator, yielding a 2 element associative array:
- entity: The machine name of an entity type, such as "node" or "block_content".
- bundle: The machine name of a bundle, such as "page" or "article".
File
- core/modules/content_moderation/src/EntityTypeInfo.php, line 264
Class
- EntityTypeInfo
- Manipulates entity type information.
Namespace
Drupal\content_moderation
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | protected function getModeratedBundles() { /** @var ConfigEntityTypeInterface $type */ foreach ( $this ->filterNonRevisionableEntityTypes( $this ->entityTypeManager->getDefinitions()) as $type_name => $type ) { $result = $this ->entityTypeManager ->getStorage( $type_name ) ->getQuery() ->condition( 'third_party_settings.content_moderation.enabled' , TRUE) ->execute(); foreach ( $result as $bundle_name ) { yield [ 'entity' => $type ->getBundleOf(), 'bundle' => $bundle_name ]; } } } |
Please login to continue.