diff --git a/core/modules/statistics/src/Tests/StatisticsReportsTest.php b/core/modules/statistics/src/Tests/StatisticsReportsTest.php index fcb2a40..0fe2e28 100644 --- a/core/modules/statistics/src/Tests/StatisticsReportsTest.php +++ b/core/modules/statistics/src/Tests/StatisticsReportsTest.php @@ -53,7 +53,9 @@ function testPopularContentBlock() { $tags = Cache::mergeTags($tags, $this->blockingUser->getCacheTags()); $tags = Cache::mergeTags($tags, ['block_view', 'config:block_list', 'node_list', 'rendered', 'user_view']); $this->assertCacheTags($tags); - $this->assertCacheContexts($node->getCacheContexts()); + $contexts = Cache::mergeContexts($node->getCacheContexts(), $block->getCacheContexts()); + $contexts = Cache::mergeContexts($contexts, ['url.query_args:_wrapper_format']); + $this->assertCacheContexts($contexts); // Check if the node link is displayed. $this->assertRaw(\Drupal::l($node->label(), $node->urlInfo('canonical')), 'Found link to visited node.'); diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index bbe6f3e..a786a8d 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -19,13 +19,13 @@ function statistics_help($route_name, RouteMatchInterface $route_match) { case 'help.page.statistics': $output = ''; $output .= '

' . t('About') . '

'; - $output .= '

' . t('The Statistics module shows you how often content is viewed. This is useful in determining which pages of your site are most popular. For more information, see the online documentation for the Statistics module.', ['!statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/']) . '

'; + $output .= '

' . t('The Statistics module shows you how often content is viewed. This is useful in determining which pages of your site are most popular. For more information, see the online documentation for the Statistics module.', array(':statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/')) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Displaying popular content') . '
'; - $output .= '
' . t('The module includes a Popular content block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable Count content views on the Statistics page, and then you can enable and configure the block on the Block layout page.', ['!statistics-settings' => \Drupal::url('statistics.settings'), '!blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#']) . '
'; + $output .= '
' . t('The module includes a Popular content block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable Count content views on the Statistics page, and then you can enable and configure the block on the Block layout page.', array(':statistics-settings' => \Drupal::url('statistics.settings'), ':blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '
'; $output .= '
' . t('Page view counter') . '
'; - $output .= '
' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable Count content views on the Statistics page, and set the necessary permissions (View content hits) so that the counter is visible to the users.', ['!statistics-settings' => \Drupal::url('statistics.settings'), '!permissions' => \Drupal::url('user.admin_permissions', [], ['fragment' => 'module-statistics'])]) . '
'; + $output .= '
' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable Count content views on the Statistics page, and set the necessary permissions (View content hits) so that the counter is visible to the users.', array(':statistics-settings' => \Drupal::url('statistics.settings'), ':permissions' => \Drupal::url('user.admin_permissions', array(), array('fragment' => 'module-statistics')))) . '
'; $output .= '
'; return $output; @@ -54,10 +54,10 @@ function statistics_node_links_alter(array &$links, NodeInterface $entity, array if (\Drupal::currentUser()->hasPermission('view post access counter')) { $statistics = \Drupal::service('statistics.storage')->fetchViews($entity->id()); if ($statistics) { - $links['statistics_counter']['title'] = \Drupal::translation()->formatPlural($statistics['totalcount'], '1 view', '@count views'); - $node_links['statistics'] = [ + $statistics_links['statistics_counter']['title'] = \Drupal::translation()->formatPlural($statistics['totalcount'], '1 view', '@count views'); + $links['statistics'] = [ '#theme' => 'links__node__statistics', - '#links' => $links, + '#links' => $statistics_links, '#attributes' => array('class' => array('links', 'inline')), ]; }