You are here

function _google_tag_variable_info_generic in GoogleTagManager 7.2

Implements hook_variable_info().

6 calls to _google_tag_variable_info_generic()
_google_tag_variable_info_domain in includes/variable.inc
Implements hook_variable_info().
_google_tag_variable_info_language in includes/variable.inc
Implements hook_variable_info().
_google_tag_variable_info_path in includes/variable.inc
Implements hook_variable_info().
_google_tag_variable_info_realm in includes/variable.inc
Implements hook_variable_info().
_google_tag_variable_info_role in includes/variable.inc
Implements hook_variable_info().

... See full list

File

includes/variable.inc, line 223
Contains the variable definitions.

Code

function _google_tag_variable_info_generic($config, $options) {

  // Gather data.
  $config += array(
    'adjective' => 'selected',
    'element' => 'options',
  );
  extract($config);
  $args = array(
    '@adjective' => $adjective,
    '@uc_adjective' => ucfirst($adjective),
    '@plural' => $plural,
  );

  // Build variables.
  $variables[$toggle] = array(
    'type' => 'select',
    'title' => special_t('Insert snippet for specific @plural', $args, $options),
    'options' => array(
      GOOGLE_TAG_EXCLUDE_LISTED => special_t('All @plural except the @adjective @plural', $args, $options),
      GOOGLE_TAG_INCLUDE_LISTED => special_t('Only the @adjective @plural', $args, $options),
    ),
    'default' => GOOGLE_TAG_EXCLUDE_LISTED,
  );
  if ($adjective == 'selected') {
    $variables[$list] = array(
      'type' => 'options',
      'title' => special_t('@uc_adjective @plural', $args, $options),
      'default' => array(),
      'options' => $options,
    );
  }
  else {
    $variables[$list] = array(
      'type' => 'text',
      'title' => special_t('@uc_adjective @plural', $args, $options),
      'description' => $description,
      'default' => $default,
      'validate callback' => '_google_tag_validate_text',
      'element' => array(
        '#rows' => $rows,
      ),
    );
  }
  return $variables;
}