diff --git a/config/install/shariff_backend.settings.yml b/config/install/shariff_backend.settings.yml new file mode 100644 index 0000000..d00630c --- /dev/null +++ b/config/install/shariff_backend.settings.yml @@ -0,0 +1,2 @@ +cache_ttl: '0' +simulate_counts: 0 \ No newline at end of file diff --git a/config/schema/shariff_backend.settings.yml b/config/schema/shariff_backend.settings.yml index 01638bc..c716ed6 100644 --- a/config/schema/shariff_backend.settings.yml +++ b/config/schema/shariff_backend.settings.yml @@ -11,3 +11,9 @@ shariff_backend.settings: facebook_app_secret: type: string label: 'Facebook application client secret' + base_domain: + type: string + label: 'Base domain of production instance' + simulate_counts: + type: boolean + label: 'Indicate if the counts should be simulated.' \ No newline at end of file diff --git a/shariff_backend.info.yml b/shariff_backend.info.yml index 5aa40fe..fb355cf 100644 --- a/shariff_backend.info.yml +++ b/shariff_backend.info.yml @@ -3,3 +3,4 @@ type: module description: Integration of the Shariff backend. core: 8.x package: Web services +configure: shariff_backend.settings \ No newline at end of file diff --git a/src/Form/ShariffBackendSettingsForm.php b/src/Form/ShariffBackendSettingsForm.php index 69d875a..02b7b20 100644 --- a/src/Form/ShariffBackendSettingsForm.php +++ b/src/Form/ShariffBackendSettingsForm.php @@ -51,6 +51,22 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('An optional client secret needed to access the Facebook application(required if Facebook application ID is set).'), ); + // Base Domain + $form['base_domain'] = array( + '#type' => 'textfield', + '#title' => $this->t('Base domain to check against.'), + '#default_value' => $config->get('base_domain'), + '#description' => $this->t('Can be the live domain for testing on a development machine.'), + ); + + // Simulate Counts + $form['simulate_counts'] = array( + '#type' => 'checkbox', + '#title' => $this->t('Simuate counts'), + '#default_value' => $config->get('simulate_counts'), + '#description' => $this->t('Simulate fictional counts.'), + ); + // Share count cache TTL $options = [3600, 10800, 21600, 43200, 86400, 604800]; $form['cache_ttl'] = [ @@ -73,6 +89,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ->set('cache_ttl', $form_state->getValue('cache_ttl')) ->set('facebook_app_id', $form_state->getValue('facebook_app_id')) ->set('facebook_app_secret', $form_state->getValue('facebook_app_secret')) + ->set('base_domain', $form_state->getValue('base_domain')) + ->set('simulate_counts', $form_state->getValue('simulate_counts')) ->save(); parent::submitForm($form, $form_state);