'string',
'title' => t('Matomo site ID', array(), $options),
'default' => '',
'description' => t('The user account number is unique to the websites domain. Click the Settings link in your Matomo account, then the Websites tab and enter the appropriate site ID into this field.'),
'required' => TRUE,
'group' => 'matomo',
'localize' => TRUE,
'multidomain' => TRUE,
'validate callback' => 'matomo_validate_matomo_site_id',
);
return $variables;
}
/**
* Implements hook_variable_group_info().
*/
function matomo_variable_group_info() {
$groups['matomo'] = array(
'title' => t('Matomo'),
'description' => t('Configure tracking behavior to get insights into your website traffic and marketing effectiveness.'),
'access' => 'administer matomo',
'path' => array('admin/config/system/matomo'),
);
return $groups;
}
/**
* Validate Matomo site ID variable.
*
* @param array $variable
*
* @return string
*/
function matomo_validate_matomo_site_id($variable) {
if (!preg_match('/^\d{1,}$/', $variable['value'])) {
return t('A valid Matomo site ID is an integer only.');
}
}