Problem/Motivation

Currently, there is no way to control the visibility of the script rendered by the module. If the script is not required we need to uninstall the module.

Proposed resolution

Add a Enable/Disable switch in the configuration form to stop rendering or enable rendering the JS code in footer.

Remaining tasks

Add a patch

User interface changes

A new field will be added in the Adobe configuration form to enable or disable the script rendering.

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 2997789.patch2.13 KBimalabya
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

imalabya created an issue. See original summary.

imalabya’s picture

Status: Active » Needs review
FileSize
2.13 KB

Patch to add a radio field to enable to disable the rendering of the JS code.

Manuel Garcia’s picture

Status: Needs review » Needs work

Curious, what's the use case for having the module enabled but not display the JS script?

My review:

  • +++ b/src/Form/AdobeAnalyticsAdminSettings.php
    @@ -36,6 +36,18 @@ class AdobeAnalyticsAdminSettings extends ConfigFormBase {
    +      '#type' => 'radios',
    

    This should be a checkbox.

  • +++ b/src/Form/AdobeAnalyticsAdminSettings.php
    @@ -36,6 +36,18 @@ class AdobeAnalyticsAdminSettings extends ConfigFormBase {
    +      '#title' => t('Enable'),
    

    This should be $this->t('Enabled'),

  • I think if it's decided to include this new option we'll probably need:

    • Test coverage for the new element on AdobeAnalyticsFormSubmitTest.php
    • Test coverage to ensure the new configuration works as expected on AdobeAnalyticsGeneralTest.php
    • An update hook to set the new config enabled to 1.
    m4olivei’s picture

    Status: Needs work » Postponed (maintainer needs more info)

    Curious, what's the use case for having the module enabled but not display the JS script?

    I share @Manuel Garcia's curiosity.

    Could you articulate in the issue discription your use case?