Index: sites/all/modules/contrib/google_tag/google_tag.variable.inc
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- sites/all/modules/contrib/google_tag/google_tag.variable.inc	(revision )
+++ sites/all/modules/contrib/google_tag/google_tag.variable.inc	(revision )
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @file
+ * Definition of variables for Variable API module.
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function google_tag_variable_info($options) {
+  // Gather data.
+  $text = t('sign up for GTM');
+  $link = l($text, 'http://www.google.com/tagmanager/web/');
+  $variables['google_tag_container_id'] = array(
+    'type' => 'string',
+    'title' => t('Container ID', array(), $options),
+    'default' => 'GTM-xxxxxx',
+    'description' => t('The ID assigned by Google Tag Manager (GTM) for this website container. To get a container ID, !link and create a container for your website.', array('!link' => $link)),
+    'required' => TRUE,
+    'group' => 'google_tag',
+    'localize' => TRUE,
+    'validate callback' => 'google_tag_validate_google_tag_container_id',
+    'multidomain' => TRUE,
+  );
+
+  return $variables;
+}
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function google_tag_variable_group_info() {
+  $groups['google_tag'] = array(
+    'title' => t('Google Tag Manager'),
+    'description' => t('Configure tracking behavior to get insights into your website traffic and marketing effectiveness.'),
+    'access' => 'administer google tag manager',
+    'path' => array('admin/config/system/google_tag'),
+  );
+
+  return $groups;
+}
+
+/**
+ * Validate Container ID variable.
+ */
+function google_tag_validate_google_tag_container_id($variable) {
+  // Replace all type of dashes (n-dash, m-dash, minus) with the normal dashes.
+  $variable['value'] = str_replace(array('–', '—', '−'), '-', $variable['value']);
+
+  if (!preg_match('/^GTM-\w{4,}$/', $variable['value'])) {
+    return t('A valid Google Tag Manager Container ID is case sensitive and formatted like GTM-xxxxxxx.');
+  }
+}
