You are here

function content_moderation_workflow_update in Drupal 9

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

Implements hook_ENTITY_TYPE_update().

File

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

Code

function content_moderation_workflow_update(WorkflowInterface $entity) {

  // Clear bundle cache so workflow gets added or removed from the bundle
  // information.
  \Drupal::service('entity_type.bundle.info')
    ->clearCachedBundles();

  // Clear field cache so extra field is added or removed.
  \Drupal::service('entity_field.manager')
    ->clearCachedFieldDefinitions();

  // Clear the views data cache so the extra field is available in views.
  if (\Drupal::moduleHandler()
    ->moduleExists('views')) {
    Views::viewsData()
      ->clear();
  }
}