function ContentModerationHooks::workflowInsert
Implements hook_ENTITY_TYPE_insert().
File
-
core/
modules/ content_moderation/ src/ Hook/ ContentModerationHooks.php, line 330
Class
- ContentModerationHooks
- Hook implementations for content_moderation.
Namespace
Drupal\content_moderation\HookCode
public function workflowInsert(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.