function yandex_metrics_page_bottom in Yandex.Metrics 8.3
Implements hook_page_bottom(). Adds Yandex.Metrics counter code to the site footer.
File
- ./
yandex_metrics.module, line 15 - The main code of Yandex.Metrics Counter module.
Code
function yandex_metrics_page_bottom(array &$page_bottom) {
$yandex_metrics_counter_code = Drupal::config('yandex_metrics.settings')
->get('counter_code');
if (!empty($yandex_metrics_counter_code) && yandex_metrics_show_counter() && yandex_metrics_show_counter_for_role()) {
$page_bottom['yandex_metrics'] = [
'#type' => 'inline_template',
'#template' => '<div class="ym-counter">{{ counter_code|raw }}</div>',
'#context' => [
'counter_code' => $yandex_metrics_counter_code,
],
'#attached' => [
'library' => [
'yandex_metrics/counter',
],
],
];
}
}