function statistics_block_alter
Same name in other branches
- 9 core/modules/statistics/statistics.module \statistics_block_alter()
- 8.9.x core/modules/statistics/statistics.module \statistics_block_alter()
- 10 core/modules/statistics/statistics.module \statistics_block_alter()
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 132
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']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.