-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPENEUROPA-1414: Updates from the master branch.
- Loading branch information
Showing
17 changed files
with
188 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
modules/oe_webtools_analytics/config/install/oe_webtools_analytics.settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
siteID: '' | ||
sitePath: '' | ||
instance: '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
modules/oe_webtools_analytics/oe_webtools_analytics.links.menu.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
oe_webtools_analytics.settings: | ||
title: Webtools Analytics | ||
description: 'Configure Webtools Analytics.' | ||
route_name: oe_webtools_analytics.settings | ||
parent: system.admin_config_system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
modules/oe_webtools_analytics/oe_webtools_analytics.permissions.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
administer webtools analytics: | ||
title: 'Administer Webtools Analytics' | ||
restrict access: false |
7 changes: 7 additions & 0 deletions
7
modules/oe_webtools_analytics/oe_webtools_analytics.routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
oe_webtools_analytics.settings: | ||
path: '/admin/config/system/oe_webtools_analytics' | ||
defaults: | ||
_form: 'Drupal\oe_webtools_analytics\Form\WebtoolsAnalyticsSettingsForm' | ||
_title: 'Webtools Analytics settings' | ||
requirements: | ||
_permission: 'administer webtools analytics' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
modules/oe_webtools_analytics/src/Form/WebtoolsAnalyticsSettingsForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Drupal\oe_webtools_analytics\Form; | ||
|
||
use Drupal\Core\Form\ConfigFormBase; | ||
use Drupal\Core\Form\FormStateInterface; | ||
|
||
/** | ||
* Settings form for module. | ||
*/ | ||
class WebtoolsAnalyticsSettingsForm extends ConfigFormBase { | ||
|
||
/** | ||
* Name of the config being edited. | ||
*/ | ||
const CONFIG_NAME = 'oe_webtools_analytics.settings'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormId() { | ||
return 'oe_webtools_analytics_settings'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$form['siteID'] = [ | ||
'#type' => 'number', | ||
'#title' => $this->t('Site ID'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('siteID'), | ||
'#description' => $this->t('The site unique numeric identifier.'), | ||
]; | ||
$form['sitePath'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Site path'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('sitePath'), | ||
'#description' => $this->t('The domain + root path without protocol.'), | ||
]; | ||
$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.'), | ||
]; | ||
|
||
return parent::buildForm($form, $form_state); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function submitForm(array &$form, FormStateInterface $form_state) { | ||
$this->config(static::CONFIG_NAME) | ||
->set('siteID', $form_state->getValue('siteID')) | ||
->set('sitePath', $form_state->getValue('sitePath')) | ||
->set('instance', $form_state->getValue('instance')) | ||
->save(); | ||
parent::submitForm($form, $form_state); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getEditableConfigNames() { | ||
return ['oe_webtools_analytics.settings']; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@api | ||
Feature: Webtools Analytics | ||
In order to provide analytics | ||
As the site manager | ||
I need to be able to configure the settings | ||
|
||
@BackupAnalyticsConfigs | ||
Scenario: Create Webtools Analytics settings | ||
Given I am logged in as a user with the "administer webtools analytics" permission | ||
And I am on "the Webtools Analytics configuration page" | ||
Then I should see "Webtools Analytics settings" | ||
When I fill in "Site ID" with "123456" | ||
And I fill in "Site path" with "ec.europa.eu/info" | ||
And I fill in "Instance" with "ec.europa.eu" | ||
And I press "Save configuration" | ||
Then I should see the message "The configuration options have been saved." | ||
And the "Site ID" field should contain "123456" | ||
And the "Site path" field should contain "ec.europa.eu/info" | ||
And the "Instance" field should contain "ec.europa.eu" |