function lightning_page_workflow_presave in Lightning Core 8.4
Same name and namespace in other branches
- 8.5 modules/lightning_page/lightning_page.module \lightning_page_workflow_presave()
Implements hook_ENTITY_TYPE_presave().
File
- modules/
lightning_page/ lightning_page.module, line 67 - Contains hook implementations for Lightning Page.
Code
function lightning_page_workflow_presave(WorkflowInterface $workflow) {
if (Drupal::isConfigSyncing()) {
return;
}
elseif ($workflow
->isNew() && $workflow
->id() === 'editorial' && Drupal::moduleHandler()
->moduleExists('lightning_workflow')) {
$type_plugin = $workflow
->getTypePlugin();
if ($type_plugin instanceof ContentModerationInterface) {
$type_plugin
->addEntityTypeAndBundle('node', 'page');
// Since this hook is invoked _after_ Workflow::preSave(), we need to
// ensure that the stored settings for the type plugin will be up-to-date
// with the changes we've made here.
if ($workflow instanceof ObjectWithPluginCollectionInterface) {
foreach ($workflow
->getPluginCollections() as $key => $plugin_collection) {
$workflow
->set($key, $plugin_collection
->getConfiguration());
}
}
}
}
}