From 973307e48262a6f47f66b451ff91ced746df5f88 Mon Sep 17 00:00:00 2001 From: Rajab Natshah <rajabn@gmail.com> Date: Thu, 18 Jun 2020 18:50:55 +0300 Subject: [PATCH] Issue #3151759: Enable Simple Workflow for all content types on new Varbase Installations by Varbase Workflow and update Automated Functional Acceptance Testing --- ...nt-searching-content-by-its-titles.feature | 3 ++- varbase.install | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/features/varbase/step2-apply-tests/05-content-management/05-06-easy-linking-internal-content-searching-content-by-its-titles.feature b/tests/features/varbase/step2-apply-tests/05-content-management/05-06-easy-linking-internal-content-searching-content-by-its-titles.feature index df1810cc..60a4cb9f 100644 --- a/tests/features/varbase/step2-apply-tests/05-content-management/05-06-easy-linking-internal-content-searching-content-by-its-titles.feature +++ b/tests/features/varbase/step2-apply-tests/05-content-management/05-06-easy-linking-internal-content-searching-content-by-its-titles.feature @@ -12,6 +12,7 @@ So that will ease the work of adding internal links in the rich text editor fiel When I select "full_html" from "Text format" And I fill in "Linking to internal content #1 title" for "Title" And I fill in the rich text editor field "Body" with "Linking to internal content #1 body" + And I select "published" from "edit-moderation-state-0-state" And I press "Save" And I wait And I should see "Linking to internal content #1 body" @@ -36,4 +37,4 @@ So that will ease the work of adding internal links in the rich text editor fiel And I wait for AJAX to finish Then I should see "Linking to internal content #1 title" When I click "Linking to internal content #1 title" in the "ul" element with the "class" attribute set to "ui-autocomplete" - Then I should not see "Linking to internal content #1 title" + Then I should not see "Linking to internal content #1 title" \ No newline at end of file diff --git a/varbase.install b/varbase.install index b3bd07cc..48d9d9a1 100644 --- a/varbase.install +++ b/varbase.install @@ -43,6 +43,30 @@ 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() -- GitLab