function lightning_workflow_node_type_insert in Lightning Workflow 8.3
Same name and namespace in other branches
- 8 lightning_workflow.module \lightning_workflow_node_type_insert()
- 8.2 lightning_workflow.module \lightning_workflow_node_type_insert()
Implements hook_ENTITY_TYPE_insert().
1 call to lightning_workflow_node_type_insert()
- lightning_workflow_install in ./
lightning_workflow.install - Implements hook_install().
File
- ./
lightning_workflow.module, line 75 - Provides workflow enhancements for Drupal.
Code
function lightning_workflow_node_type_insert(NodeTypeInterface $node_type) {
// Don't do anything during a config sync.
if (Drupal::isConfigSyncing()) {
return;
}
$workflow = $node_type
->getThirdPartySetting('lightning_workflow', 'workflow');
if ($workflow) {
_lightning_workflow_moderate_content_type($node_type, $workflow);
}
// If autosave_form is present, enable it for this content type by default.
if (Drupal::moduleHandler()
->moduleExists('autosave_form') && $node_type
->getThirdPartySetting('lightning_workflow', 'autosave', TRUE)) {
$id = $node_type
->id();
Drupal::configFactory()
->getEditable('autosave_form.settings')
->set("allowed_content_entity_types.node.bundles.{$id}", $id)
->save();
}
}