From bd650c851995110d7633cec5f8e6c6282029652d Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Tue, 29 Apr 2025 11:38:52 +0100 Subject: [PATCH] Add missing schema and set default value --- config/schema/entity_usage_updater.schema.yml | 7 +++++++ src/Form/SettingsForm.php | 1 + .../Functional/ContentModerationLinkRemoverFormTest.php | 2 ++ 3 files changed, 10 insertions(+) diff --git a/config/schema/entity_usage_updater.schema.yml b/config/schema/entity_usage_updater.schema.yml index 0a75d0b..3f106e6 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 1e09125..e28bab1 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 20b383d..8b2a308 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); -- GitLab