Problem/Motivation

Drupal and DrupalPractice ask for changes in file src/Form/GoogleAnalyticsAdminSettingsForm.php

Proposed resolution

Apply changes askeds in src/Form/GoogleAnalyticsAdminSettingsForm.php

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Thalles created an issue. See original summary.

thalles’s picture

Status: Needs work » Needs review
StatusFileSize
new10.96 KB
hass’s picture

Status: Needs review » Needs work
  1. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -57,7 +57,12 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    +        ':webpropertyid' => Url::fromUri('https://developers.google.com/analytics/resources/concepts/gaConceptsAccounts', [
    +          'fragment' => 'webProperty',
    +        ])->toString(),
    

    Not easy to read, make it a one liner, please.

  2. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -580,19 +597,30 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    +      $form_state->setValue(['google_analytics_custom_dimension', 'indexes',
    +        $dimension['index'], 'value',
    +      ], trim($dimension['value']));
           // Remove empty values from the array.
    -      if (!Unicode::strlen($form_state->getValue(['google_analytics_custom_dimension', 'indexes', $dimension['index'], 'value']))) {
    -        $form_state->unsetValue(['google_analytics_custom_dimension', 'indexes', $dimension['index']]);
    +      if (!Unicode::strlen($form_state->getValue(['google_analytics_custom_dimension', 'indexes', $dimension['index'], 'value',
    +      ]))) {
    +        $form_state->unsetValue(['google_analytics_custom_dimension', 'indexes',
    +          $dimension['index'],
    +        ]);
    

    Incorrect changes.

  3. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -580,19 +597,30 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    -      $form_state->setValue(['google_analytics_custom_metric', 'indexes', $metric['index'], 'value'], trim($metric['value']));
    +      $form_state->setValue([
    +        'google_analytics_custom_metric', 'indexes', $metric['index'], 'value',
    +      ], trim($metric['value']));
           // Remove empty values from the array.
    -      if (!Unicode::strlen($form_state->getValue(['google_analytics_custom_metric', 'indexes', $metric['index'], 'value']))) {
    -        $form_state->unsetValue(['google_analytics_custom_metric', 'indexes', $metric['index']]);
    +      if (!Unicode::strlen($form_state->getValue([
    +        'google_analytics_custom_metric', 'indexes', $metric['index'], 'value',
    +      ]))) {
    +        $form_state->unsetValue([
    +          'google_analytics_custom_metric', 'indexes', $metric['index'],
    +        ]);
    

    Incorrect changes.

  4. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -607,7 +635,9 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    +    $form_state->setValue('google_analytics_account', str_replace([
    +      '–', '—', '−',
    +    ], '-', $form_state->getValue('google_analytics_account')));
    

    Incorrect changes.

  5. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -804,16 +837,16 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    -      // addressfield_tokens.module
    +      /* addressfield_tokens.module */
    

    Incorrect changes.

  6. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -804,16 +837,16 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    -      // realname.module
    +      /* realname.module */
    

    Incorrect changes.

  7. +++ b/src/Form/GoogleAnalyticsAdminSettingsForm.php
    @@ -804,16 +837,16 @@ class GoogleAnalyticsAdminSettingsForm extends ConfigFormBase {
    -      // token.module
    +      /* token.module */
    

    Incorrect changes.

jigish.addweb’s picture

StatusFileSize
new11.1 KB

@Thalles & @hass, Please find my attached patch that works for the Coding standards on GoogleAnalyticsAdminSettingsForm.php file. Please review it and let me know if any further changes are required.

Thanks!..

jigish.addweb’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: google-analytics-3011971-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

hass’s picture

This patch is completly wrong. We never make line feeds in translatable strings. Last good patch is #2.

hass’s picture

himanshu_sindhwani’s picture

I will be working on the patch for this issue.

himanshu_sindhwani’s picture

StatusFileSize
new10.89 KB
new11.1 KB

Updated the fixes in #2.

himanshu_sindhwani’s picture

Status: Needs work » Needs review

  • ixismark committed 11e1e57 on 8.x-2.x
    [Issue #3011971]Coding Standards on GoogleanalyticsAdminSettingsform.php...
ixismark’s picture

ixismark’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.