function statistics_node_view
statistics_node_view($node, $view_mode)
Implements hook_node_view().
File
- modules/statistics/statistics.module, line 117
- Logs and displays access statistics for a site.
Code
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)) { $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( 'data' => array('statistics' => $settings), 'type' => 'setting', ); } } if ($view_mode != 'rss') { if (user_access('view post access counter')) { $statistics = statistics_get($node->nid); if ($statistics) { $links['statistics_counter']['title'] = format_plural($statistics['totalcount'], '1 read', '@count reads'); $node->content['links']['statistics'] = array( '#theme' => 'links__node__statistics', '#links' => $links, '#attributes' => array('class' => array('links', 'inline')), ); } } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!statistics!statistics.module/function/statistics_node_view/7.x