diff --git a/config/install/ucb_site_configuration.settings.yml b/config/install/ucb_site_configuration.settings.yml index 4e305b4..75e2c77 100644 --- a/config/install/ucb_site_configuration.settings.yml +++ b/config/install/ucb_site_configuration.settings.yml @@ -10,6 +10,7 @@ site_search_enabled: site_search_label: '' site_search_url: '' gtm_account: '' +tos_acceptance_enabled: false # Settings in "Content types" article_date_format: '0' diff --git a/src/Form/GeneralForm.php b/src/Form/GeneralForm.php index df154f7..d92b11c 100644 --- a/src/Form/GeneralForm.php +++ b/src/Form/GeneralForm.php @@ -260,6 +260,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $settings->get('gtm_account'), '#description' => $this->t('Google Tag Manager account number e.g. GTM-123456.'), ]; + $advanced['tos_acceptance_enabled'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Enable Terms of Service acceptance'), + '#default_value' => $settings->get('tos_acceptance_enabled'), + '#description' => $this->t('When enabled, users will be required to accept the Terms of Service before using the site. The modal will appear on user pages for users who have not yet accepted.'), + ]; $form['advanced'] = $advanced; } return parent::buildForm($form, $form_state); @@ -358,6 +364,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ->set('site_search_placeholder', $siteSearchFormValues['site_search_placeholder']) ->set('site_search_url', $siteSearchFormValues['site_search_url']) ->set('gtm_account', $form_state->getValue('gtm_account')) + ->set('tos_acceptance_enabled', $form_state->getValue('tos_acceptance_enabled')) ->save(); } parent::submitForm($form, $form_state);