function content_moderation_workflow_insert

Same name in other branches
  1. 8.9.x core/modules/content_moderation/content_moderation.module \content_moderation_workflow_insert()
  2. 10 core/modules/content_moderation/content_moderation.module \content_moderation_workflow_insert()
  3. 11.x core/modules/content_moderation/content_moderation.module \content_moderation_workflow_insert()

Implements hook_ENTITY_TYPE_insert().

File

core/modules/content_moderation/content_moderation.module, line 406

Code

function content_moderation_workflow_insert(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.