Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -19,13 +19,13 @@ function statistics_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'help.page.statistics':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . 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 <a href="!statistics_do">the online documentation for the Statistics module</a>.', array('!statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/')) . '</p>';
|
||||
$output .= '<p>' . 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 <a href=":statistics_do">online documentation for the Statistics module</a>.', array(':statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Displaying popular content') . '</dt>';
|
||||
$output .= '<dd>' . t('The module includes a <em>Popular content</em> block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable <em>Count content views</em> on the <a href="!statistics-settings">Statistics page</a>, and then you can enable and configure the block on the <a href="!blocks">Block layout page</a>.', array('!statistics-settings' => \Drupal::url('statistics.settings'), '!blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</dd>';
|
||||
$output .= '<dd>' . t('The module includes a <em>Popular content</em> block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and then you can enable and configure the block on the <a href=":blocks">Block layout page</a>.', array(':statistics-settings' => \Drupal::url('statistics.settings'), ':blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</dd>';
|
||||
$output .= '<dt>' . t('Page view counter') . '</dt>';
|
||||
$output .= '<dd>' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable <em>Count content views</em> on the <a href="!statistics-settings">Statistics page</a>, and set the necessary <a href="!permissions">permissions</a> (<em>View content hits</em>) 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')))) . '</dd>';
|
||||
$output .= '<dd>' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and set the necessary <a href=":permissions">permissions</a> (<em>View content hits</em>) 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')))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
|
||||
|
@ -39,9 +39,9 @@ function statistics_help($route_name, RouteMatchInterface $route_match) {
|
|||
*/
|
||||
function statistics_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) {
|
||||
if (!$node->isNew() && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {
|
||||
$build['statistics_content_counter']['#attached']['library'][] = 'statistics/drupal.statistics';
|
||||
$build['#attached']['library'][] = 'statistics/drupal.statistics';
|
||||
$settings = array('data' => array('nid' => $node->id()), 'url' => Url::fromUri('base:' . drupal_get_path('module', 'statistics') . '/statistics.php')->toString());
|
||||
$build['statistics_content_counter']['#attached']['drupalSettings']['statistics'] = $settings;
|
||||
$build['#attached']['drupalSettings']['statistics'] = $settings;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ function statistics_node_view(array &$build, EntityInterface $node, EntityViewDi
|
|||
*/
|
||||
function statistics_node_links_alter(array &$node_links, NodeInterface $entity, array &$context) {
|
||||
if ($context['view_mode'] != 'rss') {
|
||||
$node_links['#cache']['contexts'][] = 'user.permissions';
|
||||
if (\Drupal::currentUser()->hasPermission('view post access counter')) {
|
||||
$statistics = statistics_get($entity->id());
|
||||
if ($statistics) {
|
||||
|
@ -60,6 +61,7 @@ function statistics_node_links_alter(array &$node_links, NodeInterface $entity,
|
|||
'#attributes' => array('class' => array('links', 'inline')),
|
||||
);
|
||||
}
|
||||
$node_links['#cache']['max-age'] = \Drupal::config('statistics.settings')->get('display_max_age');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue