Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it clearer how to configure the server instance for Europa Analytics #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions modules/oe_webtools_analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ needs a default configuration in the form of two variables:

* Site ID: This is the unique ID that identifies your site.
* Site path: This is the base path that leads to your site.
* Instance: Choose the Europa Analytics server that the data will be reported to.

This configuration can be provided using Drupal 8 configuration system or by
providing details in your sites settings.php file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,22 @@ public function buildForm(array $form, FormStateInterface $form_state): array {
'#default_value' => $this->config(static::CONFIG_NAME)->get('sitePath'),
'#description' => $this->t('The domain + root path without protocol.'),
];

$instance_options = [
'ec.europa.eu' => $this->t('ec.europa.eu - for European Commission websites'),
'europa.eu' => $this->t('europa.eu - for inter-institutional websites'),
'testing' => $this->t('testing - for testing purposes'),
];

$instance_value = $this->config(static::CONFIG_NAME)->get('instance');

$form['instance'] = [
'#type' => 'textfield',
'#title' => $this->t('Instance'),
'#default_value' => $this->config(static::CONFIG_NAME)->get('instance'),
'#description' => $this->t('The server instance. e.g. testing, ec.europa.eu or europa.eu.'),
'#type' => 'radios',
'#title' => $this->t('Europa Analytics server instance'),
'#options' => $instance_options,
// Default to ec.europa.eu if no value is configured.
'#default_value' => $instance_value ?: 'ec.europa.eu',
'#description' => $this->t('The Europa Analytics server to report analytics data to.'),
];

return parent::buildForm($form, $form_state);
Expand Down