function statistics_block_alter in Drupal 10
Same name and namespace in other branches
- 8 core/modules/statistics/statistics.module \statistics_block_alter()
- 9 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 130 - 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']);
}
}