You are here

function variable_realm_params in Variable 7

Same name and namespace in other branches
  1. 7.2 variable_realm/variable_realm.module \variable_realm_params()

Get realm parameters from query string.

2 calls to variable_realm_params()
variable_realm_form_key_current in variable_realm/variable_realm.form.inc
Get current realm key from query string.
variable_realm_init in variable_realm/variable_realm.module
Implements hook_init()

File

variable_realm/variable_realm.module, line 38
Variable API module - Realms

Code

function variable_realm_params($realm_name = NULL) {
  $realm_params =& drupal_static(__FUNCTION__);
  if (!isset($realm_params)) {
    $realm_params = array();
    foreach (variable_realm_info() as $realm => $realm_info) {
      if (!empty($realm_info['form switcher'])) {
        $param = VARIABLE_REALM_QUERY_STRING . $realm;
        if (!empty($_GET[$param]) && array_key_exists($_GET[$param], variable_realm_keys($realm))) {
          $realm_params[$realm] = $_GET[$param];
        }
      }
    }
    drupal_alter('variable_realm_params', $realm_params);
  }
  if ($realm_name) {
    return isset($realm_params[$realm_name]) ? $realm_params[$realm_name] : FALSE;
  }
  else {
    return $realm_params;
  }
}