function matomo_requirements in Matomo Analytics 8
Same name and namespace in other branches
- 7.2 matomo.install \matomo_requirements()
Implements hook_requirements().
File
- ./
matomo.install, line 58 - Installation file for Matomo Analytics module.
Code
function matomo_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$config = \Drupal::config('matomo.settings');
// Raise warning if Matomo user account has not been set yet.
if (!preg_match('/^\\d{1,}$/', $config
->get('site_id'))) {
$requirements['matomo_site_id'] = [
'title' => t('Matomo module'),
'description' => t('Matomo module has not been configured yet. Please configure its settings from the <a href=":url">Matomo settings page</a>.', [
':url' => Url::fromRoute('matomo.admin_settings_form')
->toString(),
]),
'severity' => REQUIREMENT_WARNING,
'value' => t('Not configured'),
];
}
}
return $requirements;
}