You are here

function content_moderation_entity_bundle_delete in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_delete()

Implements hook_entity_bundle_delete().

File

core/modules/content_moderation/content_moderation.module, line 392
Contains content_moderation.module.

Code

function content_moderation_entity_bundle_delete($entity_type_id, $bundle_id) {

  // Remove non-configuration based bundles from content moderation based
  // workflows when they are removed.
  foreach (Workflow::loadMultipleByType('content_moderation') as $workflow) {
    if ($workflow
      ->getTypePlugin()
      ->appliesToEntityTypeAndBundle($entity_type_id, $bundle_id)) {
      $workflow
        ->getTypePlugin()
        ->removeEntityTypeAndBundle($entity_type_id, $bundle_id);
      $workflow
        ->save();
    }
  }
}