statistics_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode)
Implements hook_ENTITY_TYPE_view() for node entities.
File
- core/modules/statistics/statistics.module, line 40
- Logs and displays content statistics for a site.
Code
1 2 3 4 5 6 7 | 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 [ '#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 [ '#attached' ][ 'drupalSettings' ][ 'statistics' ] = $settings ; } } |
Please login to continue.