function statistics_block_alter

statistics_block_alter(&$definitions)

Implements hook_block_alter().

Removes the "popular" block from display if the module is not configured to count content views.

File

core/modules/statistics/statistics.module, line 201
Logs and displays content statistics for a site.

Code

function statistics_block_alter(&$definitions) {
  $statistics_count_content_views = \Drupal::config('statistics.settings')->get('count_content_views');
  if (empty($statistics_count_content_views)) {
    unset($definitions['statistics_popular_block']);
  }
}

© 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/core!modules!statistics!statistics.module/function/statistics_block_alter/8.1.x