diff --git a/config/schema/entity_usage_updater.schema.yml b/config/schema/entity_usage_updater.schema.yml index 0a75d0bec055dbc60b18a405347bb3f8bace9bfb..3f106e6c14eed4f49e16180b0755491dfd83b07f 100644 --- a/config/schema/entity_usage_updater.schema.yml +++ b/config/schema/entity_usage_updater.schema.yml @@ -13,3 +13,10 @@ entity_usage_updater.plugin.html_link: convert_to_linkit: type: boolean label: 'Convert normal links to LinkIt links' + +workflows.workflow.*.third_party.entity_usage_updater: + type: mapping + mapping: + default_unpublished_state: + type: string + label: 'ID of the default unpublished state' diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 1e091257637362f597129d8df692d5f12cd2ddf3..e28bab1138fd234f2f93026a0dbce5927c378c31 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -82,6 +82,7 @@ final class SettingsForm extends ConfigFormBase { $form['workflow'][$workflow->id()] = [ '#type' => 'select', '#options' => $options, + '#default_value' => $workflow->getThirdPartySetting('entity_usage_updater', 'default_unpublished_state'), '#title' => $this->t('Select default unpublished state for %label workflow', ['%label' => $workflow->label()]), ]; } diff --git a/tests/src/Functional/ContentModerationLinkRemoverFormTest.php b/tests/src/Functional/ContentModerationLinkRemoverFormTest.php index 20b383d43d1031686bd78ab983b1360a710b61d9..8b2a308af241793e07e759f15064ce481af8ca80 100644 --- a/tests/src/Functional/ContentModerationLinkRemoverFormTest.php +++ b/tests/src/Functional/ContentModerationLinkRemoverFormTest.php @@ -171,6 +171,7 @@ class ContentModerationLinkRemoverFormTest extends ModerationStateTestBase { ->pageTextContains('Created Links remover transition.'); $this->drupalGet('admin/config/content/entity-usage-updater'); + $this->assertSame('archived', $this->assertSession()->fieldExists('workflow[editorial]')->getValue()); $this->assertCount(2, $this->assertSession() ->fieldExists('workflow[editorial]') ->findAll('css', 'option')); @@ -178,6 +179,7 @@ class ContentModerationLinkRemoverFormTest extends ModerationStateTestBase { ->fieldExists('workflow[editorial]') ->selectOption('links_removed'); $this->assertSession()->buttonExists('Save')->press(); + $this->assertSame('links_removed', $this->assertSession()->fieldExists('workflow[editorial]')->getValue()); // Allow the user to use the new transition. $role_ids = $this->adminUser->getRoles(TRUE);