function _google_tag_variable_info_advanced in GoogleTagManager 7.2
Same name and namespace in other branches
- 7 includes/variable.inc \_google_tag_variable_info_advanced()
Implements hook_variable_info().
File
- includes/
variable.inc, line 284 - Contains the variable definitions.
Code
function _google_tag_variable_info_advanced($options) {
// Gather data.
$args = array(
'@path' => 'https://developers.google.com/tag-manager/devguide#security',
);
$description = t('The types of tags, triggers, and variables <strong>allowed</strong> on a page. Enter one class per line. For more information, refer to the <a href="@path">developer documentation</a>.', $args, $options);
$args = array(
'@path' => 'https://www.drupal.org/project/datalayer',
);
$markup = t('If the default data layer name is used, then enable the <a href="@path">data layer</a> module to manage the insertion of tags, triggers, and variables in one place. If a different module is used for this purpose, there may be some contamination and override of values from this and the other module.', $args, $options);
$args = array(
'@path' => 'https://tagmanager.google.com/#/admin',
);
$description2 = t('The environment ID to use with this website container. To get an environment ID, <a href="@path">select Environments</a>, create an environment, then click the "Get Snippet" action. The environment ID and token will be in the snippet.', $args, $options);
// Build variables.
$disabled = !module_exists('datalayer');
$variables['data_layer'] = array(
'type' => 'string',
'title' => t('Data layer', array(), $options),
'description' => t('The name of the data layer. Default value is "dataLayer". In most cases, use the default.', array(), $options),
'default' => 'dataLayer',
'validate callback' => '_google_tag_validate_data_layer',
'element' => array(
'#attributes' => array(
'placeholder' => array(
'dataLayer',
),
),
'#required' => TRUE,
'#prefix' => $disabled ? '<span>' . $markup . '</span>' : '',
),
);
$variables['include_classes'] = array(
'type' => 'boolean',
'title' => t('Add classes to the data layer', array(), $options),
'description' => t('If checked, then the listed classes will be added to the data layer.', array(), $options),
'default' => 0,
'validate callback' => '_google_tag_validate_listed_classes',
);
$variables['whitelist_classes'] = array(
'type' => 'text',
'title' => t('White-listed classes', array(), $options),
'description' => $description,
'default' => GOOGLE_TAG_WHITELIST_CLASSES,
'validate callback' => '_google_tag_validate_text',
'element' => array(
'#rows' => 5,
'#states' => _google_tag_variable_states('include_classes'),
),
);
$variables['blacklist_classes'] = array(
'type' => 'text',
'title' => t('Black-listed classes', array(), $options),
'description' => t('The types of tags, triggers, and variables <strong>forbidden</strong> on a page. Enter one class per line.', array(), $options),
'default' => GOOGLE_TAG_BLACKLIST_CLASSES,
'validate callback' => '_google_tag_validate_text',
'element' => array(
'#rows' => 5,
'#states' => _google_tag_variable_states('include_classes'),
),
);
$variables['include_environment'] = array(
'type' => 'boolean',
'title' => t('Include an environment', array(), $options),
'description' => t('If checked, then the applicable snippets will include the environment items below. Enable <strong>only for development</strong> purposes.', array(), $options),
'default' => 0,
);
$variables['environment_id'] = array(
'type' => 'string',
'title' => t('Environment ID', array(), $options),
'description' => $description2,
'default' => '',
'validate callback' => '_google_tag_validate_environment_id',
'element' => array(
'#attributes' => array(
'placeholder' => array(
'env-x',
),
),
'#size' => 10,
'#maxlength' => 7,
'#states' => _google_tag_variable_states('include_environment'),
),
);
$variables['environment_token'] = array(
'type' => 'string',
'title' => t('Environment token', array(), $options),
'description' => t('The authentication token for this environment.', array(), $options),
'default' => '',
'element' => array(
'#attributes' => array(
'placeholder' => array(
'xxxxxxxxxxxxxxxxxxxxxx',
),
),
'#size' => 20,
'#maxlength' => 25,
'#states' => _google_tag_variable_states('include_environment'),
),
);
return $variables;
}