Skip to content
Snippets Groups Projects
Commit f9ca2717 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3151759: Enable Simple Workflow for all content types on new Varbase...

Issue #3151759: Enable Simple Workflow for all content types on new Varbase Installations  by Varbase Workflow and update Automated Functional Acceptance Testing
parent 973307e4
No related branches found
No related tags found
No related merge requests found
...@@ -43,30 +43,6 @@ function varbase_install() { ...@@ -43,30 +43,6 @@ function varbase_install() {
// Set front page to "node". // Set front page to "node".
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE); \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 // Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions. // And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver() \Drupal::classResolver()
......
...@@ -458,6 +458,30 @@ function varbase_after_install_finished(array &$install_state) { ...@@ -458,6 +458,30 @@ function varbase_after_install_finished(array &$install_state) {
$config_factory->setData($config_data)->save(TRUE); $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 // Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions. // And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver() \Drupal::classResolver()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment