The statistics module overwrites #attached, wiping out existing values set by other modules, if it happens to run after them. It should not do that, but keep the existing array intact.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

berenddeboer’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, statistics-keep-attached.patch, failed testing.

berenddeboer’s picture

Status: Needs work » Needs review
FileSize
724 bytes

Status: Needs review » Needs work

The last submitted patch, 3: statistics-keep-attached-2470525-3.patch, failed testing.

osman’s picture

I confirm the issue.

Enabling Statistics.module overrides existing $node->content['#attached']['js'] array content.

Thanks berenddeboer for reporting it.

osman’s picture

Status: Needs work » Needs review
osman’s picture

Version: 7.36 » 7.x-dev
Priority: Normal » Major
FileSize
1.08 KB

Seems like this issue is Drupal 7.x only. 8.x is not affected.

Attached patch is formatted better to comply with coding standards.

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community
David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +7.40 release notes

Committed to 7.x - thanks!

Sigh, I remember that I discovered this exact same issue when reviewing the original patch (#1209532-181: Count node views via AJAX in the statistics module), but I missed that it was not addressed before I committed the final version...

  • David_Rothstein committed ab4064e on 7.x
    Issue #2470525 by berenddeboer, osman: statistics_node_view overwrites #...

Status: Fixed » Closed (fixed)

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