function content_moderation_workflow_update

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

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

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