From ab92c65bebe682a6895f3a0d4d15f55c2a6de06d Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Fri, 20 Feb 2026 09:26:30 +0200 Subject: [PATCH] Remove labels from config form * hakuvahti_tos_checkbox_label: * hakuvahti_tos_link_text --- config/install/helfi_hakuvahti.settings.yml | 2 -- config/schema/helfi_hakuvahti.schema.yml | 8 -------- helfi_hakuvahti.install | 2 -- src/DrupalSettings.php | 2 -- src/Form/SettingsForm.php | 13 ------------- src/Hook/ConfigIgnoreHook.php | 2 -- tests/src/Kernel/DrupalSettingsTest.php | 4 ---- tests/src/Kernel/SettingsFormTest.php | 4 ---- 8 files changed, 37 deletions(-) diff --git a/config/install/helfi_hakuvahti.settings.yml b/config/install/helfi_hakuvahti.settings.yml index 3b5e5ed..945d75a 100644 --- a/config/install/helfi_hakuvahti.settings.yml +++ b/config/install/helfi_hakuvahti.settings.yml @@ -1,5 +1,3 @@ langcode: en -hakuvahti_tos_checkbox_label: 'I consent to the processing of my personal data' -hakuvahti_tos_link_text: 'Read our privacy policy (pdf).' hakuvahti_tos_link_url: '' hakuvahti_instructions_link_url: '' diff --git a/config/schema/helfi_hakuvahti.schema.yml b/config/schema/helfi_hakuvahti.schema.yml index 88fe293..6b54549 100644 --- a/config/schema/helfi_hakuvahti.schema.yml +++ b/config/schema/helfi_hakuvahti.schema.yml @@ -21,14 +21,6 @@ helfi_hakuvahti.settings: base_url: type: string - hakuvahti_tos_checkbox_label: - type: label - label: 'Hakuvahti terms of service checkbox label' - translatable: true - hakuvahti_tos_link_text: - type: label - label: 'Hakuvahti terms of service link text' - translatable: true hakuvahti_tos_link_url: type: label label: 'Hakuvahti terms of service URL' diff --git a/helfi_hakuvahti.install b/helfi_hakuvahti.install index f1a73dc..2b1ab48 100644 --- a/helfi_hakuvahti.install +++ b/helfi_hakuvahti.install @@ -14,8 +14,6 @@ declare(strict_types=1); */ function helfi_hakuvahti_update_11001(): void { \Drupal::configFactory()->getEditable('helfi_hakuvahti.settings') - ->set('hakuvahti_tos_checkbox_label', 'I consent to the processing of my personal data') - ->set('hakuvahti_tos_link_text', 'Read our privacy policy (pdf).') ->set('hakuvahti_tos_link_url', '') ->set('hakuvahti_instructions_link_url', '') ->set('langcode', 'en') diff --git a/src/DrupalSettings.php b/src/DrupalSettings.php index e171243..504dbd6 100644 --- a/src/DrupalSettings.php +++ b/src/DrupalSettings.php @@ -17,8 +17,6 @@ * Settings that are exposed to JavaScript. */ public const array EXPOSED_SETTINGS = [ - 'hakuvahti_tos_checkbox_label', - 'hakuvahti_tos_link_text', 'hakuvahti_tos_link_url', 'hakuvahti_instructions_link_url', ]; diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index eeb511e..bb0cd0e 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -30,19 +30,6 @@ protected function getEditableConfigNames() : array { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state): array { - $form['settings']['hakuvahti_tos_checkbox_label'] = [ - '#type' => 'textfield', - '#config_target' => 'helfi_hakuvahti.settings:hakuvahti_tos_checkbox_label', - '#title' => $this->t('Hakuvahti terms of service checkbox label'), - '#description' => $this->t('Label for the terms of service checkbox.'), - ]; - - $form['settings']['hakuvahti_tos_link_text'] = [ - '#type' => 'textfield', - '#config_target' => 'helfi_hakuvahti.settings:hakuvahti_tos_link_text', - '#title' => $this->t('Hakuvahti terms of service link text'), - ]; - $form['settings']['hakuvahti_tos_link_url'] = [ '#type' => 'textfield', '#title' => $this->t('Hakuvahti terms of service URL'), diff --git a/src/Hook/ConfigIgnoreHook.php b/src/Hook/ConfigIgnoreHook.php index 49095e5..8c0b71b 100644 --- a/src/Hook/ConfigIgnoreHook.php +++ b/src/Hook/ConfigIgnoreHook.php @@ -18,8 +18,6 @@ class ConfigIgnoreHook { public static function alter(array &$settings): void { // If config ignore module is enabled, these // values are managed from the SettingsForm only. - $settings[] = 'helfi_hakuvahti.settings:hakuvahti_tos_checkbox_label'; - $settings[] = 'helfi_hakuvahti.settings:hakuvahti_tos_link_text'; $settings[] = 'helfi_hakuvahti.settings:hakuvahti_tos_link_url'; $settings[] = 'helfi_hakuvahti.settings:hakuvahti_instructions_link_url'; } diff --git a/tests/src/Kernel/DrupalSettingsTest.php b/tests/src/Kernel/DrupalSettingsTest.php index 78e8ee9..3e6a496 100644 --- a/tests/src/Kernel/DrupalSettingsTest.php +++ b/tests/src/Kernel/DrupalSettingsTest.php @@ -45,8 +45,6 @@ public function testApplyToWithoutBaseUrl(): void { public function testApplyToExposesSettings(): void { $this->config('helfi_hakuvahti.settings') ->set('base_url', 'https://hakuvahti.example.com') - ->set('hakuvahti_tos_checkbox_label', 'I agree') - ->set('hakuvahti_tos_link_text', 'Privacy policy') ->set('hakuvahti_tos_link_url', 'https://example.com/tos') ->set('hakuvahti_instructions_link_url', 'https://example.com/instructions') ->save(); @@ -55,8 +53,6 @@ public function testApplyToExposesSettings(): void { $this->container->get(DrupalSettings::class)->applyTo($build); $settings = $build['#attached']['drupalSettings']['hakuvahti']['texts']; - $this->assertEquals('I agree', $settings['hakuvahti_tos_checkbox_label']); - $this->assertEquals('Privacy policy', $settings['hakuvahti_tos_link_text']); $this->assertEquals('https://example.com/tos', $settings['hakuvahti_tos_link_url']); $this->assertEquals('https://example.com/instructions', $settings['hakuvahti_instructions_link_url']); } diff --git a/tests/src/Kernel/SettingsFormTest.php b/tests/src/Kernel/SettingsFormTest.php index 67ebbbc..513c823 100644 --- a/tests/src/Kernel/SettingsFormTest.php +++ b/tests/src/Kernel/SettingsFormTest.php @@ -37,8 +37,6 @@ protected function setUp(): void { public function testSubmitSavesConfig(): void { $form_state = new FormState(); $form_state->setValues([ - 'hakuvahti_tos_checkbox_label' => 'I agree', - 'hakuvahti_tos_link_text' => 'Privacy policy', 'hakuvahti_tos_link_url' => 'https://example.com/tos', 'hakuvahti_instructions_link_url' => 'https://example.com/instructions', ]); @@ -48,8 +46,6 @@ public function testSubmitSavesConfig(): void { $this->assertEmpty($form_state->getErrors()); $config = $this->config('helfi_hakuvahti.settings'); - $this->assertEquals('I agree', $config->get('hakuvahti_tos_checkbox_label')); - $this->assertEquals('Privacy policy', $config->get('hakuvahti_tos_link_text')); $this->assertEquals('https://example.com/tos', $config->get('hakuvahti_tos_link_url')); $this->assertEquals('https://example.com/instructions', $config->get('hakuvahti_instructions_link_url')); }