statistics_node_view

Versions
7
statistics_node_view($node, $build_mode)

Implement hook_node_view().

Code

modules/statistics/statistics.module, line 108

<?php
function statistics_node_view($node, $build_mode) {
  if ($build_mode != 'rss') {
    $links = array();
    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',
      '#links' => $links,
      '#attributes' => array('class' => array('links', 'inline')),
    );
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.