summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-10 14:00:35 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-10 14:00:35 -0400
commitab4064e9ae9071a01f3e65446608f17d1f565daf (patch)
treef709643491a2e000e53b88e038839658e6b55f81
parentc60d7b098a9db9abd9a8de3b6f125df3a2bfda24 (diff)
downloadbrdo-ab4064e9ae9071a01f3e65446608f17d1f565daf.tar.gz
brdo-ab4064e9ae9071a01f3e65446608f17d1f565daf.tar.bz2
Issue #2470525 by berenddeboer, osman: statistics_node_view overwrites #attached JavaScript
-rw-r--r--CHANGELOG.txt2
-rw-r--r--modules/statistics/statistics.module7
2 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 699318087..b988a1e2a 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,8 @@
Drupal 7.40, xxxx-xx-xx (development version)
-----------------------
+- Fixed a bug in the Statistics module that caused JavaScript files attached to
+ a node while it is being viewed to be omitted from the page.
- Added an optional 'project:' prefix that can be added to dependencies in a
module's .info file to indicate which project the dependency resides in.
- Fixed various bugs that occurred after hooks were invoked early in the Drupal
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index f665a14f2..b2561d24b 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -118,10 +118,9 @@ function statistics_node_view($node, $view_mode) {
// Attach Ajax node count statistics if configured.
if (variable_get('statistics_count_content_views', 0) && variable_get('statistics_count_content_views_ajax', 0)) {
if (!empty($node->nid) && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {
- $node->content['#attached']['js'] = array(
- drupal_get_path('module', 'statistics') . '/statistics.js' => array(
- 'scope' => 'footer'
- ),
+ $statistics = drupal_get_path('module', 'statistics') . '/statistics.js';
+ $node->content['#attached']['js'][$statistics] = array(
+ 'scope' => 'footer',
);
$settings = array('data' => array('nid' => $node->nid), 'url' => url(drupal_get_path('module', 'statistics') . '/statistics.php'));
$node->content['#attached']['js'][] = array(