From de67ae3fd0d032d619c530dca7ff87b12828ed57 Mon Sep 17 00:00:00 2001 From: Deepak Mishra Date: Tue, 15 Oct 2024 18:06:24 +0530 Subject: [PATCH 1/6] Update google_tag form on tour dashboard. --- .../AcquiaCmsTour/GoogleTagManagerForm.php | 232 +++++++++++++++--- .../tests/src/Functional/GoogleTagManager.php | 8 +- 2 files changed, 206 insertions(+), 34 deletions(-) diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index 930c4d7c8..d7fb70dff 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -3,8 +3,10 @@ namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour; use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; +use Drupal\Component\Utility\Html; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\google_tag\Entity\TagContainer; /** * Plugin implementation of the acquia_cms_tour. @@ -62,15 +64,110 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#collapsible' => TRUE, '#collapsed' => TRUE, ]; - $form[$module]['snippet_parent_uri'] = [ - '#type' => 'textfield', - '#required' => TRUE, - '#title' => $this->t('Snippet parent URI'), - '#attributes' => ['placeholder' => $this->t('public:/')], - '#default_value' => $this->config('google_tag.settings')->get('uri'), - '#prefix' => '
' . $module_info['description'], - '#suffix' => "
", + $form['#id'] = Html::getId($form_state->getBuildInfo()['form_id']); + $accounts_wrapper_id = Html::getUniqueId('accounts-add-more-wrapper'); + $account_default_value = $this->config('google_tag.settings')->get('default_google_tag_entity'); + $form[$module]['accounts_wrapper'] = [ + '#type' => 'fieldset', + '#prefix' => '
', + '#suffix' => '
', + ]; + // Filter order (tabledrag). + $form[$module]['accounts_wrapper']['accounts'] = [ + '#input' => FALSE, + '#tree' => TRUE, + '#type' => 'table', + '#tabledrag' => [ + [ + 'action' => 'order', + 'relationship' => 'sibling', + 'group' => 'account-order-weight', + ], + ], + ]; + + $accounts = $form_state->getValue('accounts', []); + if ($accounts === []) { + $config_name = 'google_tag.container.'. $account_default_value; + $entity_accounts = $this->config($config_name)->get('tag_container_ids'); + foreach ($entity_accounts as $index => $account) { + $accounts[$index]['value'] = $account; + $accounts[$index]['weight'] = $index; + } + // Default fallback. + if (count($accounts) === 0) { + $accounts[] = ['value' => '', 'weight' => 0]; + } + } + + foreach ($accounts as $index => $account) { + $form[$module]['accounts_wrapper']['accounts'][$index]['#attributes']['class'][] = 'draggable'; + $form[$module]['accounts_wrapper']['accounts'][$index]['#weight'] = $account['weight']; + $form[$module]['accounts_wrapper']['accounts'][$index]['value'] = [ + '#default_value' => (string) ($account['value'] ?? ''), + '#maxlength' => 20, + '#required' => (count($accounts) === 1), + '#size' => 20, + '#type' => 'textfield', + '#pattern' => TagContainer::GOOGLE_TAG_MATCH, + '#ajax' => [ + 'callback' => [self::class, 'storeGtagAccountsCallback'], + 'disable-refocus' => TRUE, + 'event' => 'change', + 'wrapper' => 'advanced-settings-wrapper', + ], + '#attributes' => [ + 'data-disable-refocus' => 'true', + ], + ]; + + $form[$module]['accounts_wrapper']['accounts'][$index]['weight'] = [ + '#type' => 'weight', + '#title' => $this->t('Weight for @title', ['@title' => (string) ($account['value'] ?? '')]), + '#title_display' => 'invisible', + '#delta' => 50, + '#default_value' => $index, + '#parents' => ['accounts', $index, 'weight'], + '#attributes' => ['class' => ['account-order-weight']], + ]; + + // If there is more than one id, add the remove button. + if (count($accounts) > 1) { + $form[$module]['accounts_wrapper']['accounts'][$index]['remove'] = [ + '#type' => 'submit', + '#value' => $this->t('Remove'), + '#name' => 'remove_gtag_id_' . $index, + '#parameter_index' => $index, + '#limit_validation_errors' => [ + ['accounts'], + ], + '#submit' => [ + [self::class, 'removeGtagCallback'], + ], + '#ajax' => [ + 'callback' => [self::class, 'gtagFormCallback'], + 'wrapper' => $form['#id'], + ], + ]; + } + } + + $id_prefix = implode('-', ['accounts_wrapper', 'accounts']); + // Add blank account. + $form[$module]['accounts_wrapper']['add_gtag_id'] = [ + '#type' => 'submit', + '#value' => $this->t('Add another ID'), + '#name' => str_replace('-', '_', $id_prefix) . '_add_gtag_id', + '#submit' => [ + [self::class, 'addGtagCallback'], + ], + '#ajax' => [ + 'callback' => [self::class, 'ajaxRefreshAccounts'], + 'wrapper' => $accounts_wrapper_id, + 'effect' => 'fade', + ], ]; + $form[$module]['actions']['submit'] = [ '#type' => 'submit', '#value' => 'Save', @@ -82,25 +179,23 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#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' => "", - ]; - } + $form[$module]['actions']['advanced'] = [ + '#prefix' => '
', + '#markup' => $this->linkGenerator->generate( + 'Advanced', + Url::fromRoute('entity.google_tag_container.single_form') + ), + '#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; } @@ -109,8 +204,24 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - $snippet_parent_uri = $form_state->getValue(['snippet_parent_uri']); - $this->config('google_tag.settings')->set('uri', $snippet_parent_uri)->save(); + $tag_container_ids = []; + $default_id = ''; + $account_default_value = $this->config('google_tag.settings')->get('default_google_tag_entity'); + $config_name = 'google_tag.container.'. $account_default_value; + foreach ($form_state->getValue('accounts') as $account) { + if (!$default_id) { + $default_id = $account['value']; + } + $tag_container_ids[$account['weight']] = $account['value']; + } + // Need to save tags without weights otherwise it doesn't show up on UI. + $this->configFactory->getEditable($config_name)->set('tag_container_ids', array_values($tag_container_ids))->save(); + if ($this->config($config_name)->get('id') === NULL) { + // Set the ID and Label based on the first Google Tag. + $config_id = uniqid($default_id . '.', TRUE); + $this->configFactory->getEditable($config_name)->set('id', $config_id); + $this->configFactory->getEditable($config_name)->set('label', $default_id); + } $this->setConfigurationState(); $this->messenger()->addStatus('The configuration options have been saved.'); } @@ -130,4 +241,67 @@ public function checkMinConfiguration(): bool { return (bool) $uri; } + /** + * Submit handler for the "add-one-more" button. + * + * Increments the max counter and causes a rebuild. + */ + public static function storeGtagAccountsCallback(array &$form, FormStateInterface $form_state) { + // Update Advanced Settings Form. + return $form['google_tag']['accounts_wrapper']; + } + + /** + * Submit handler for the "remove one" button. + * + * Decrements the max counter and causes a form rebuild. + */ + public static function removeGtagCallback(array &$form, FormStateInterface $form_state) { + $triggering_element = $form_state->getTriggeringElement(); + $index = $triggering_element['#parameter_index']; + $accounts = $form_state->getValue('accounts', []); + unset($accounts[$index]); + $form_state->setValue('accounts', $accounts); + $form_state->setRebuild(); + } + + /** + * Callback for both ajax account buttons. + * + * Selects and returns the fieldset with the names in it. + */ + public static function gtagFormCallback(array &$form, FormStateInterface $form_state) { + return $form; + } + + /** + * Submit handler for the "add-one-more" button. + * + * Increments the max counter and causes a rebuild. + */ + public static function addGtagCallback(array &$form, FormStateInterface $form_state) { + $accounts = $form_state->getValue('accounts', []); + $accounts[] = [ + 'value' => '', + 'weight' => count($accounts), + ]; + $form_state->setValue('accounts', $accounts); + $form_state->setRebuild(); + } + + /** + * Callback for add more gtag accounts. + * + * @param array $form + * Form array. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * Form state. + * + * @return mixed + * Accounts wrapper. + */ + public static function ajaxRefreshAccounts(array $form, FormStateInterface $form_state) { + return $form['google_tag']['accounts_wrapper']; + } + } diff --git a/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php b/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php index 3420376e1..ecc2857bc 100644 --- a/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php +++ b/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php @@ -55,16 +55,14 @@ public function testGoogleTagManager() { $container = $assert_session->elementExists('css', '.acquia-cms-google-tag-manager-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('Snippet parent URI'); // Save Snippet parent URI. - $dummy_uri = 'public://tempdir'; - $container->fillField('edit-snippet-parent-uri', $dummy_uri); + $dummy_tag = 'GTM-000000'; + $container->fillField('edit-accounts-0-value', $dummy_tag); $container->pressButton('Save'); $assert_session->pageTextContains('The configuration options have been saved.'); // Test that the config values we expect are set correctly. $google_tag_uri = $this->config('google_tag.settings')->get('uri'); - $this->assertSame($google_tag_uri, $dummy_uri); + $this->assertSame($google_tag_uri, $dummy_tag); } } From 8077b4ab40661cb473be6a69f1165faf7bac74ea Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Thu, 17 Oct 2024 13:51:16 +0530 Subject: [PATCH 2/6] ACMS-4229: Update Google Tag tour plugin and styling. --- modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css | 8 ++++++++ .../src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css b/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css index d00d04537..3b4a75b22 100644 --- a/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css +++ b/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css @@ -73,6 +73,14 @@ .acms-dashboard-form-wrapper .js-form-wrapper { border: 1px solid #808080; } +.acms-dashboard-form-wrapper .js-form-wrapper .js-form-wrapper { + border: 0px; + padding: 0; + margin: 0; +} +.acms-dashboard-form-wrapper .js-form-wrapper .js-form-wrapper .fieldset__wrapper{ + margin-left: 0; +} .section-top { display: flex; align-items: center; diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index d7fb70dff..d933f6ba0 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -69,7 +69,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { $account_default_value = $this->config('google_tag.settings')->get('default_google_tag_entity'); $form[$module]['accounts_wrapper'] = [ '#type' => 'fieldset', - '#prefix' => '
', + '#prefix' => '
+ Effortlessly configure and manage Google Tag Manager containers to + seamlessly track application insights.', '#suffix' => '
', ]; // Filter order (tabledrag). From cbfc7770399467f62325b5689f75d39422aa6398 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Thu, 17 Oct 2024 14:05:35 +0530 Subject: [PATCH 3/6] ACMS-4229: Fix error warning with google tag manager tour plugin. --- .../src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index d933f6ba0..cbc4ebc94 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -92,9 +92,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { if ($accounts === []) { $config_name = 'google_tag.container.'. $account_default_value; $entity_accounts = $this->config($config_name)->get('tag_container_ids'); - foreach ($entity_accounts as $index => $account) { - $accounts[$index]['value'] = $account; - $accounts[$index]['weight'] = $index; + if ($entity_accounts){ + foreach ($entity_accounts as $index => $account) { + $accounts[$index]['value'] = $account; + $accounts[$index]['weight'] = $index; + } } // Default fallback. if (count($accounts) === 0) { From a5d44351a502ff62c85d977b65e23b0abf653a18 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Thu, 17 Oct 2024 14:32:31 +0530 Subject: [PATCH 4/6] ACMS-4229: Fix static code analysis. --- composer.json | 1 + composer.lock | 4 ++-- modules/acquia_cms_common/composer.json | 4 ++-- modules/acquia_cms_toolbar/composer.json | 6 +++--- .../src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 271564852..ebcaa1aac 100644 --- a/composer.json +++ b/composer.json @@ -263,6 +263,7 @@ "php-http/discovery": true, "phpro/grumphp-shim": true, "phpstan/extension-installer": true, + "tbachert/spi": true, "webdriver-binary/binary-chromedriver": true, "wikimedia/composer-merge-plugin": true }, diff --git a/composer.lock b/composer.lock index a9e8af221..0eeb64765 100644 --- a/composer.lock +++ b/composer.lock @@ -2323,7 +2323,7 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_common", - "reference": "2e9464aa5f9e5f0be09e1726c3276319be0b8c5e" + "reference": "36ebfe06447b4f28301a18995d197336fb6ce1f3" }, "require": { "acquia/drupal-environment-detector": "^1.5", @@ -2777,7 +2777,7 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_toolbar", - "reference": "1b719afab9745ba4f3d212a025cc9d9486d6a0e8" + "reference": "0cc6f26997c253705d6d7087a8878f7e690a29a0" }, "require": { "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", diff --git a/modules/acquia_cms_common/composer.json b/modules/acquia_cms_common/composer.json index 7ff6addf8..a191def54 100644 --- a/modules/acquia_cms_common/composer.json +++ b/modules/acquia_cms_common/composer.json @@ -35,8 +35,8 @@ "require-dev": { "acquia/cohesion": "^7.4 || ^8.0", "drupal/acquia_claro": "^1.3", - "drupal/node_revision_delete":"^2", - "drupal/reroute_email":"^2.2", + "drupal/node_revision_delete": "^2", + "drupal/reroute_email": "^2.2", "drupal/shield": "^1.7" }, "conflict": { diff --git a/modules/acquia_cms_toolbar/composer.json b/modules/acquia_cms_toolbar/composer.json index 8659b0e72..9540e671d 100644 --- a/modules/acquia_cms_toolbar/composer.json +++ b/modules/acquia_cms_toolbar/composer.json @@ -7,6 +7,9 @@ "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", "drupal/admin_toolbar": "^3.3" }, + "conflict": { + "drupal/acquia_claro": "<1.4" + }, "repositories": { "assets": { "type": "composer", @@ -17,9 +20,6 @@ "url": "https://packages.drupal.org/8" } }, - "conflict": { - "drupal/acquia_claro": "<1.4" - }, "config": { "allow-plugins": { "composer/installers": true, diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index cbc4ebc94..7431fecfd 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -90,7 +90,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $accounts = $form_state->getValue('accounts', []); if ($accounts === []) { - $config_name = 'google_tag.container.'. $account_default_value; + $config_name = 'google_tag.container.' . $account_default_value; $entity_accounts = $this->config($config_name)->get('tag_container_ids'); if ($entity_accounts){ foreach ($entity_accounts as $index => $account) { @@ -211,7 +211,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $tag_container_ids = []; $default_id = ''; $account_default_value = $this->config('google_tag.settings')->get('default_google_tag_entity'); - $config_name = 'google_tag.container.'. $account_default_value; + $config_name = 'google_tag.container.' . $account_default_value; foreach ($form_state->getValue('accounts') as $account) { if (!$default_id) { $default_id = $account['value']; From 512d07701db0d2ef1857300ba516512698491c2b Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Fri, 18 Oct 2024 15:09:21 +0530 Subject: [PATCH 5/6] ACMS-4229: Add the missing functionality. --- .../AcquiaCmsTour/GoogleTagManagerForm.php | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index 7431fecfd..eebbf0c28 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -208,9 +208,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { + $tag_container_ids = []; - $default_id = ''; + $default_id = $config_id = ''; $account_default_value = $this->config('google_tag.settings')->get('default_google_tag_entity'); + $config_name = 'google_tag.container.' . $account_default_value; foreach ($form_state->getValue('accounts') as $account) { if (!$default_id) { @@ -218,14 +220,32 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } $tag_container_ids[$account['weight']] = $account['value']; } + if ($account_default_value == NULL) { + // Set the ID and Label based on the first Google Tag. + $config_name .= uniqid($default_id . '.', TRUE); + } // Need to save tags without weights otherwise it doesn't show up on UI. - $this->configFactory->getEditable($config_name)->set('tag_container_ids', array_values($tag_container_ids))->save(); if ($this->config($config_name)->get('id') === NULL) { // Set the ID and Label based on the first Google Tag. $config_id = uniqid($default_id . '.', TRUE); - $this->configFactory->getEditable($config_name)->set('id', $config_id); - $this->configFactory->getEditable($config_name)->set('label', $default_id); + TagContainer::create([ + 'id' => $config_id, + 'label' => $default_id, + 'tag_container_ids' => array_values($tag_container_ids), + 'status' => 1, + 'weight' => 0, + ])->save(); } + else { + $config_id = $this->config($config_name)->get('id'); + $config = TagContainer::load($config_id); + $config->set('tag_container_ids', array_values($tag_container_ids)); + $config->save(); + } + if($this->configFactory->getEditable('google_tag.settings')->get('default_google_tag_entity') !== NULL) { + $this->configFactory->getEditable('google_tag.settings')->set('default_google_tag_entity', $config_id)->save(); + } + $this->setConfigurationState(); $this->messenger()->addStatus('The configuration options have been saved.'); } From ceee729a905d186a7eb9059141c9c399fc8e32ee Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Fri, 18 Oct 2024 15:19:16 +0530 Subject: [PATCH 6/6] ACMS-4229: Update Google Tag tour tests as per 2.x version. --- .../src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php | 2 +- .../tests/src/Functional/GoogleTagManager.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index eebbf0c28..e713f4f0d 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -261,7 +261,7 @@ public function ignoreConfig(array &$form, FormStateInterface $form_state) { * {@inheritdoc} */ public function checkMinConfiguration(): bool { - $uri = $this->config('google_tag.settings')->get('uri'); + $uri = $this->config('google_tag.settings')->get('default_google_tag_entity'); return (bool) $uri; } diff --git a/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php b/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php index ecc2857bc..d7084745a 100644 --- a/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php +++ b/modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php @@ -56,13 +56,13 @@ public function testGoogleTagManager() { // Assert that save and advanced buttons are present on form. $assert_session->buttonExists('Save'); // Save Snippet parent URI. - $dummy_tag = 'GTM-000000'; + $dummy_tag = 'GT-XXXXXXXXX'; $container->fillField('edit-accounts-0-value', $dummy_tag); $container->pressButton('Save'); $assert_session->pageTextContains('The configuration options have been saved.'); // Test that the config values we expect are set correctly. - $google_tag_uri = $this->config('google_tag.settings')->get('uri'); - $this->assertSame($google_tag_uri, $dummy_tag); + $tag_id = $this->config($this->config('google_tag.settings')->get('default_google_tag_entity'))->get('tag_container_ids'); + $this->assertEquals($tag_id, [$dummy_tag]); } }