function yandex_metrics_page_build in Yandex.Metrics 7.2
Same name and namespace in other branches
- 8.2 yandex_metrics.module \yandex_metrics_page_build()
- 7.3 yandex_metrics.module \yandex_metrics_page_build()
- 7 yandex_metrics.module \yandex_metrics_page_build()
Implements hook_page_build(). Adds Yandex.Metrica counter code to the site footer.
See also
http://drupal.org/node/224333#hook_footer
File
- ./
yandex_metrics.module, line 159 - The main code of Yandex.Metrics Counter module.
Code
function yandex_metrics_page_build(&$page) {
$yandex_metrics_counter_code = variable_get('yandex_metrics_counter_code', '');
if (!empty($yandex_metrics_counter_code) && yandex_metrics_show_counter() && yandex_metrics_show_counter_for_role()) {
$path = drupal_get_path('module', 'yandex_metrics');
drupal_add_css($path . '/css/yandex_metrics.css');
$page['page_bottom']['yandex_metrics'] = array(
'#type' => 'markup',
'#markup' => '<div class="ym-counter">' . $yandex_metrics_counter_code . '</div>',
);
}
}