Commit b1b5de3b authored by hass's avatar hass
Browse files

#1702522: Declare variables for Variable API module and i18n module

parent a6db9f96
<?php
/**
* @file
* Definition of variables for Variable API module..
*/
/**
* Implements hook_variable_info().
*/
function googleanalytics_variable_info($options) {
$variables['googleanalytics_account'] = array(
'type' => 'string',
'title' => t('Web Property ID', array(), $options),
'default' => 'UA-',
'description' => t('This ID is unique to each site you want to track separately, and is in the form of UA-xxxxxxx-yy. To get a Web Property ID, <a href="@analytics">register your site with Google Analytics</a>, or if you already have registered your site, go to your Google Analytics Settings page to see the ID next to every site profile. <a href="@webpropertyid">Find more information in the documentation</a>.', array('@analytics' => 'http://www.google.com/analytics/', '@webpropertyid' => 'http://code.google.com/apis/analytics/docs/concepts/gaConceptsAccounts.html#webProperty'), $options),
'required' => TRUE,
'group' => 'googleanalytics',
'localize' => TRUE,
'validate callback' => 'googleanalytics_validate_googleanalytics_account',
);
return $variables;
}
/**
* Implements hook_variable_group_info().
*/
function googleanalytics_variable_group_info() {
$groups['googleanalytics'] = array(
'title' => t('Google Analytics'),
'description' => t('Configure tracking behavior to get insights into your website traffic and marketing effectiveness.'),
'access' => 'administer google analytics',
'path' => array('admin/config/system/googleanalytics'),
);
return $groups;
}
/**
* Validate Web Property ID variable.
*/
function googleanalytics_validate_googleanalytics_account($variable) {
if (!preg_match('/^UA-\d{4,}-\d+$/', $variable['value'])) {
return t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.');
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment