From 250b79fa6ff965cc6aec6e73b4a84af2a1b28e9d Mon Sep 17 00:00:00 2001 From: Ankit Pathak Date: Thu, 12 Sep 2024 17:49:55 +0530 Subject: [PATCH 1/3] ACMS-4210: Removing google_analytics. --- composer.json | 5 - composer.lock | 43 +----- modules/acquia_cms_tour/composer.json | 2 +- .../src/Controller/DashboardController.php | 2 +- .../AcquiaCmsTour/GoogleAnalyticsForm.php | 139 ------------------ .../src/Functional/GoogleAnalyticsTest.php | 81 ---------- .../src/Kernel/AcquiaTourDashboardTest.php | 1 - 7 files changed, 6 insertions(+), 267 deletions(-) delete mode 100644 modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleAnalyticsForm.php delete mode 100644 modules/acquia_cms_tour/tests/src/Functional/GoogleAnalyticsTest.php diff --git a/composer.json b/composer.json index 9958b1bac..87044e447 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,6 @@ "drupal/acquia_cms_tour": "dev-develop", "drupal/consumer_image_styles": "^4.0", "drupal/gin": "^3.0@RC", - "drupal/google_analytics": "dev-3430780-automated-drupal-11", "drupal/google_tag": "^2.0", "drupal/honeypot": "^2.1", "drupal/recaptcha": "^3.2", @@ -237,10 +236,6 @@ "type": "vcs", "url": "https://git.drupalcode.org/issue/consumer_image_styles-3429496.git" }, - "google_analytics": { - "type": "vcs", - "url": "https://git.drupalcode.org/issue/google_analytics-3430780.git" - }, "config_filter": { "type": "vcs", "url": "https://git.drupalcode.org/issue/config_filter-3428542.git" diff --git a/composer.lock b/composer.lock index 234a05ee2..916f9d94a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "27bccd4f0c31eb8011206ae736f01300", + "content-hash": "149137665af68b068eab512243b1c056", "packages": [ { "name": "acquia/acquia-cms-starterkit", @@ -2848,7 +2848,7 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_tour", - "reference": "764e6fafa17d35fc38bf3f4642f0f70b3a8afbbb" + "reference": "429c29f394efe3885ae3b0dc65b05221842e060b" }, "require": { "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", @@ -2856,7 +2856,7 @@ }, "require-dev": { "drupal/acquia_cms_place": "^1", - "drupal/google_analytics": "dev-3430780-automated-drupal-11", + "drupal/google_tag": "^2.0", "drupal/recaptcha": "^3" }, "type": "drupal-module", @@ -5256,40 +5256,6 @@ } ] }, - { - "name": "drupal/google_analytics", - "version": "dev-3430780-automated-drupal-11", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/issue/google_analytics-3430780.git", - "reference": "dcccc1d4332b3134b54a178a23114631c7780a7f" - }, - "require-dev": { - "drupal/token": "^1.7" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-4.x": "4.x-dev" - } - }, - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "See contributors", - "homepage": "https://www.drupal.org/node/49388/committers" - } - ], - "description": "Allows your site to be tracked by Google Analytics by adding a Javascript tracking code to every page.", - "homepage": "https://www.drupal.org/project/google_analytics", - "support": { - "issues": "https://www.drupal.org/project/issues/google_analytics", - "source": "https://git.drupalcode.org/project/google_analytics" - }, - "time": "2024-08-29T22:35:14+00:00" - }, { "name": "drupal/google_tag", "version": "2.0.6", @@ -7111,7 +7077,7 @@ "homepage": "https://www.drupal.org/user/124705" }, { - "name": "Nick_vh", + "name": "nick_vh", "homepage": "https://www.drupal.org/user/122682" } ], @@ -19823,7 +19789,6 @@ "drupal/acquia_cms_toolbar": 20, "drupal/acquia_cms_tour": 20, "drupal/gin": 5, - "drupal/google_analytics": 20, "drupal/sitestudio_config_management": 20, "drupal/sitestudio_gin": 20, "drupal/acquia_dam": 20 diff --git a/modules/acquia_cms_tour/composer.json b/modules/acquia_cms_tour/composer.json index d8f904d41..2f8735bb7 100644 --- a/modules/acquia_cms_tour/composer.json +++ b/modules/acquia_cms_tour/composer.json @@ -9,7 +9,7 @@ }, "require-dev": { "drupal/acquia_cms_place": "^1", - "drupal/google_analytics": "dev-3430780-automated-drupal-11", + "drupal/google_tag": "^2.0", "drupal/recaptcha": "^3" }, "config": { diff --git a/modules/acquia_cms_tour/src/Controller/DashboardController.php b/modules/acquia_cms_tour/src/Controller/DashboardController.php index c76cb7900..76218b1ed 100644 --- a/modules/acquia_cms_tour/src/Controller/DashboardController.php +++ b/modules/acquia_cms_tour/src/Controller/DashboardController.php @@ -226,7 +226,7 @@ public function content() { $form['help_text'] = [ '#type' => 'markup', '#markup' => $this->t("

It seems like you have installed minimal Acquia CMS, which does not have any specific configurations. You are all set. Once you enable any of the modules supported by the wizard, they should start appearing here. - (ex. google_analytics, gecoder, recaptcha, cohesion etc.).

"), + (ex. google_tag, gecoder, recaptcha, cohesion etc.)."), ]; } $form['check_total']['#value'] = $total; diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleAnalyticsForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleAnalyticsForm.php deleted file mode 100644 index be4e4f469..000000000 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleAnalyticsForm.php +++ /dev/null @@ -1,139 +0,0 @@ -module; - if ($this->isModuleEnabled()) { - $configured = $this->getConfigurationState(); - if ($configured) { - $form['check_icon'] = [ - '#prefix' => '', - '#suffix' => "", - ]; - } - - $module_path = $this->moduleHandler->getModule($module)->getPathname(); - $module_info = $this->infoParser->parse($module_path); - $form[$module] = [ - '#type' => 'details', - '#title' => $module_info['name'], - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ]; - - $form[$module]['web_property_id'] = [ - '#type' => 'textfield', - '#required' => TRUE, - '#title' => $this->t('Web Property ID'), - '#placeholder' => 'UA-xxx-xxx-xxx', - '#default_value' => $this->config('google_analytics.settings')->get('account'), - '#prefix' => '
' . $module_info['description'], - '#suffix' => "
", - ]; - $form[$module]['actions']['submit'] = [ - '#type' => 'submit', - '#value' => 'Save', - '#prefix' => '
', - ]; - $form[$module]['actions']['ignore'] = [ - '#type' => 'submit', - '#value' => 'Ignore', - '#limit_validation_errors' => [], - '#submit' => ['::ignoreConfig'], - ]; - if (isset($module_info['configure'])) { - $form[$module]['actions']['advanced'] = [ - '#prefix' => '
', - '#markup' => $this->linkGenerator->generate( - 'Advanced', - Url::fromRoute($module_info['configure']) - ), - '#suffix' => "
", - ]; - $form[$module]['actions']['advanced']['information'] = [ - '#prefix' => 'i', - '#suffix' => "", - ]; - $form[$module]['actions']['advanced']['tooltip-text'] = [ - '#prefix' => '', - '#markup' => $this->t("Opens Advance Configuration in new tab"), - '#suffix' => "
", - ]; - } - } - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $property_id = $form_state->getValue(['web_property_id']); - if ($property_id) { - $this->config('google_analytics.settings')->set('account', $property_id)->save(); - $this->state->set('google_analytics_progress', TRUE); - $this->messenger()->addStatus('The configuration options have been saved.'); - } - // Update state. - $this->setConfigurationState(); - } - - /** - * {@inheritdoc} - */ - public function ignoreConfig(array &$form, FormStateInterface $form_state) { - $this->setConfigurationState(); - } - - /** - * {@inheritdoc} - */ - public function checkMinConfiguration() { - $account = $this->config('google_analytics.settings')->get('account'); - return $account ? TRUE : FALSE; - } - -} diff --git a/modules/acquia_cms_tour/tests/src/Functional/GoogleAnalyticsTest.php b/modules/acquia_cms_tour/tests/src/Functional/GoogleAnalyticsTest.php deleted file mode 100644 index 445fe7ad1..000000000 --- a/modules/acquia_cms_tour/tests/src/Functional/GoogleAnalyticsTest.php +++ /dev/null @@ -1,81 +0,0 @@ -assertSession(); - - $account = $this->drupalCreateUser(['access acquia cms tour dashboard']); - $this->drupalLogin($account); - - // Visit the tour page. - $this->drupalGet('/admin/tour/dashboard'); - $assert_session->statusCodeEquals(200); - $container = $assert_session->elementExists('css', '.acquia-cms-google-analytics-form'); - // Assert that save and advanced buttons are present on form. - $assert_session->buttonExists('Save'); - // Assert that the expected fields show up. - $assert_session->fieldExists('Web Property ID'); - // Save Web Property ID. - $dummy_web_property_id = 'UA-334567-6789078'; - $container->fillField('edit-web-property-id', $dummy_web_property_id); - $container->pressButton('Save'); - $this->assertTrue($this->isValidPropertyId($dummy_web_property_id)); - $assert_session->pageTextContains('The configuration options have been saved.'); - // Test that the config values we expect are set correctly. - $google_tag_prop_id = $this->config('google_analytics.settings')->get('account'); - $this->assertSame($google_tag_prop_id, $dummy_web_property_id); - } - - /** - * Function to check GA web property id. - */ - public function isValidPropertyId($dummy_web_property_id) { - if (!preg_match('/^UA-\d+-\d+$/', $dummy_web_property_id)) { - return FALSE; - } - return TRUE; - } - -} diff --git a/modules/acquia_cms_tour/tests/src/Kernel/AcquiaTourDashboardTest.php b/modules/acquia_cms_tour/tests/src/Kernel/AcquiaTourDashboardTest.php index 0c5965156..dd86497aa 100644 --- a/modules/acquia_cms_tour/tests/src/Kernel/AcquiaTourDashboardTest.php +++ b/modules/acquia_cms_tour/tests/src/Kernel/AcquiaTourDashboardTest.php @@ -43,7 +43,6 @@ class AcquiaTourDashboardTest extends KernelTestBase { public function testAcquiaCmsTourPlugin() { $expected_plugin_order = [ 'geocoder', - 'google_analytics', 'google_tag', 'recaptcha', ]; From 0c5fe5e595f0958dc2b81538f75a614355cca3a7 Mon Sep 17 00:00:00 2001 From: Ankit Pathak Date: Wed, 18 Sep 2024 11:31:56 +0530 Subject: [PATCH 2/3] ACMS-4210: Removing google_tag too. --- composer.lock | 10 ++++------ modules/acquia_cms_tour/composer.json | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 916f9d94a..e015cd2a8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "149137665af68b068eab512243b1c056", + "content-hash": "4a9b1a3321b7089b2e7d3704d7302d8f", "packages": [ { "name": "acquia/acquia-cms-starterkit", @@ -2848,7 +2848,7 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_tour", - "reference": "429c29f394efe3885ae3b0dc65b05221842e060b" + "reference": "04e968e9b96a2b1fb974296aee91951ec849f6b9" }, "require": { "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", @@ -2856,7 +2856,6 @@ }, "require-dev": { "drupal/acquia_cms_place": "^1", - "drupal/google_tag": "^2.0", "drupal/recaptcha": "^3" }, "type": "drupal-module", @@ -19790,12 +19789,11 @@ "drupal/acquia_cms_tour": 20, "drupal/gin": 5, "drupal/sitestudio_config_management": 20, - "drupal/sitestudio_gin": 20, - "drupal/acquia_dam": 20 + "drupal/sitestudio_gin": 20 }, "prefer-stable": true, "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/modules/acquia_cms_tour/composer.json b/modules/acquia_cms_tour/composer.json index 2f8735bb7..ca400c78d 100644 --- a/modules/acquia_cms_tour/composer.json +++ b/modules/acquia_cms_tour/composer.json @@ -9,7 +9,6 @@ }, "require-dev": { "drupal/acquia_cms_place": "^1", - "drupal/google_tag": "^2.0", "drupal/recaptcha": "^3" }, "config": { From b06290446f895d20c74feee8704299561f278d49 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Thu, 19 Sep 2024 23:56:14 +0530 Subject: [PATCH 3/3] Removed google_tag as it's not added in tour yet. --- modules/acquia_cms_tour/src/Controller/DashboardController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/acquia_cms_tour/src/Controller/DashboardController.php b/modules/acquia_cms_tour/src/Controller/DashboardController.php index 76218b1ed..cb68b3e61 100644 --- a/modules/acquia_cms_tour/src/Controller/DashboardController.php +++ b/modules/acquia_cms_tour/src/Controller/DashboardController.php @@ -226,7 +226,7 @@ public function content() { $form['help_text'] = [ '#type' => 'markup', '#markup' => $this->t("

It seems like you have installed minimal Acquia CMS, which does not have any specific configurations. You are all set. Once you enable any of the modules supported by the wizard, they should start appearing here. - (ex. google_tag, gecoder, recaptcha, cohesion etc.).

"), + (ex. gecoder, recaptcha, cohesion etc.)."), ]; } $form['check_total']['#value'] = $total;