function _yandex_metrics_reports_is_popular_content_enabled in Yandex.Metrics 8.2
Same name and namespace in other branches
- 6.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_is_popular_content_enabled()
- 7.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_is_popular_content_enabled()
1 call to _yandex_metrics_reports_is_popular_content_enabled()
- yandex_metrics_reports_cron in yandex_metrics_reports/
yandex_metrics_reports.module - Implements hook_cron().
File
- yandex_metrics_reports/
yandex_metrics_reports.module, line 415 - The main code of Yandex.Metrics Reports module.
Code
function _yandex_metrics_reports_is_popular_content_enabled() {
$result = db_select("block")
->condition("module", "yandex_metrics_reports")
->condition("delta", "popular_content")
->condition("status", 1)
->fields('block')
->execute()
->fetchField();
$views = \Drupal\views\Views::getView('popular_content');
// if views is present and it`s enabled
if (!empty($views) && !$views->disabled) {
$result = 1;
}
return !empty($result);
}