You are here

function _token_var_get_variables in Token Variable 7

Add checkboxes to token_var_settings_form form.

Parameters

array $form:

1 call to _token_var_get_variables()
token_var_settings_form in ./token_var.admin.inc
Build token_var_settings_form form.

File

./token_var.admin.inc, line 39
Administrative pages for the token variables.

Code

function _token_var_get_variables(&$form) {
  global $conf;
  $options = array();
  $header = array(
    'name' => t("Variable Name"),
    'value' => t("Value"),
  );
  foreach ($conf as $key => $value) {
    if (!is_array($value) && !is_object($value)) {
      $options[$key] = array(
        'name' => $key,
        'value' => $key,
      );
    }
    elseif (is_array($value) && $key != TOKENIZE_DRUPAL_VARIABLES_OPTIONS) {
      foreach ($value as $var_key => $var_value) {
        if (!is_array($var_value) && !is_object($var_value)) {
          $options[$key . "|" . $var_key] = array(
            'name' => $key . "|" . $var_key,
            'value' => $var_key,
          );
        }
      }
    }
  }
  $form[TOKENIZE_DRUPAL_VARIABLES_OPTIONS] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#default_value' => variable_get(TOKENIZE_DRUPAL_VARIABLES_OPTIONS, array()),
  );
}