Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/install/helfi_hakuvahti.settings.yml
Original file line number Diff line number Diff line change
@@ -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: ''
8 changes: 0 additions & 8 deletions config/schema/helfi_hakuvahti.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 0 additions & 2 deletions helfi_hakuvahti.install
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 0 additions & 2 deletions src/DrupalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
Expand Down
13 changes: 0 additions & 13 deletions src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 0 additions & 2 deletions src/Hook/ConfigIgnoreHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
4 changes: 0 additions & 4 deletions tests/src/Kernel/DrupalSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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']);
}
Expand Down
4 changes: 0 additions & 4 deletions tests/src/Kernel/SettingsFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
Expand All @@ -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'));
}
Expand Down