diff --git a/varbase.install b/varbase.install index 48d9d9a14de8d6bb2acafcc6bb510772767a1c96..b3bd07cc6a2686b7c42a473c1c59fa5c88181ae7 100644 --- a/varbase.install +++ b/varbase.install @@ -43,30 +43,6 @@ function varbase_install() { // Set front page to "node". \Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE); - // Enable Simple Workflow for all content types on new Varbase Installations. - if (\Drupal::moduleHandler()->moduleExists('varbase_workflow')) { - $node_types = \Drupal\node\Entity\NodeType::loadMultiple(); - foreach ($node_types as $node_type) { - - $config_factory = \Drupal::service('config.factory'); - $workflow_type_settings = $config_factory->getEditable('workflows.workflow.varbase_simple_workflow')->get('type_settings'); - - if (isset($workflow_type_settings['entity_types'])) { - if (isset($workflow_type_settings['entity_types']['node'])) { - if (!in_array($node_type, $workflow_type_settings['entity_types']['node'])) { - $workflow_type_settings['entity_types']['node'][] = $node_type->id(); - } - } - else { - $workflow_type_settings['entity_types']['node'] = []; - $workflow_type_settings['entity_types']['node'][] = $node_type->id(); - } - - $config_factory->getEditable('workflows.workflow.varbase_simple_workflow')->set('type_settings', $workflow_type_settings)->save(TRUE); - } - } - } - // Entity updates to clear up any mismatched entity and/or field definitions // And Fix changes were detected in the entity type and field definitions. \Drupal::classResolver() diff --git a/varbase.profile b/varbase.profile index 540a1926be6c1cbee13bc6ff2ba56dcf6a1cc018..0a1d84cc4009b9864e67020de68f1f372a02adf4 100644 --- a/varbase.profile +++ b/varbase.profile @@ -458,6 +458,30 @@ function varbase_after_install_finished(array &$install_state) { $config_factory->setData($config_data)->save(TRUE); } + // Enable Simple Workflow for all content types on new Varbase Installations. + if (\Drupal::moduleHandler()->moduleExists('varbase_workflow')) { + $node_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple(); + foreach ($node_types as $node_type) { + + $config_factory = \Drupal::service('config.factory'); + $workflow_type_settings = $config_factory->getEditable('workflows.workflow.varbase_simple_workflow')->get('type_settings'); + + if (isset($workflow_type_settings['entity_types'])) { + if (isset($workflow_type_settings['entity_types']['node'])) { + if (!in_array($node_type, $workflow_type_settings['entity_types']['node'])) { + $workflow_type_settings['entity_types']['node'][] = $node_type->id(); + } + } + else { + $workflow_type_settings['entity_types']['node'] = []; + $workflow_type_settings['entity_types']['node'][] = $node_type->id(); + } + + $config_factory->getEditable('workflows.workflow.varbase_simple_workflow')->set('type_settings', $workflow_type_settings)->save(TRUE); + } + } + } + // Entity updates to clear up any mismatched entity and/or field definitions // And Fix changes were detected in the entity type and field definitions. \Drupal::classResolver()