From e48b869b5923b70fe7cb87b729a4fae4dead963b Mon Sep 17 00:00:00 2001 From: Ankit Pathak Date: Thu, 12 Sep 2024 17:49:55 +0530 Subject: [PATCH] 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 d483e3ef8..0230372b2 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", @@ -241,10 +240,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 d8bbdb7f0..fa6fd2348 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": "9a5c8fadfa8e94f6d480dd19098c57f4", + "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", @@ -5220,40 +5220,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", @@ -7075,7 +7041,7 @@ "homepage": "https://www.drupal.org/user/124705" }, { - "name": "Nick_vh", + "name": "nick_vh", "homepage": "https://www.drupal.org/user/122682" } ], @@ -19861,7 +19827,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 }, 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', ];