You are here

function variable_realm_params in Variable 7.2

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

Get realm parameters from query string.

3 calls to variable_realm_params()
variable_realm_form_key_current in variable_realm/variable_realm.form.inc
Get current realm key from query string or from current realm value.
variable_realm_init in variable_realm/variable_realm.module
Implements hook_init()
_variable_realm_form_submit_redirect in variable_realm/variable_realm.form.inc
Redirect to current page after form submission, using query string parameters.

File

variable_realm/variable_realm.module, line 88
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];
        }
      }
    }
  }
  if ($realm_name) {
    return isset($realm_params[$realm_name]) ? $realm_params[$realm_name] : FALSE;
  }
  else {
    return $realm_params;
  }
}