function content_moderation_entity_bundle_delete

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_delete()
  2. 8.9.x core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_delete()
  3. 10 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 331

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();
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.