You are here

function variable_realm_weight in Variable 7

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

Get / set realm weights.

The default realm will have a weight of 0. Realms with higher weights will override global variables.

Parameters

$realm: Optional realm name

$weight: Optional numeric value for realm weight.

$default: Default weight to set if no $weight is set.

Return value

array() Ordered realm names.

3 calls to variable_realm_weight()
variable_realm_add in variable_realm/variable_realm.module
Set values for variable realm
variable_realm_current in variable_realm/variable_realm.module
Get current realm values ordered by weights.
_variable_realm_controller in variable_realm/variable_realm.module
Create realm controller object.

File

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

Code

function variable_realm_weight($realm = NULL, $weight = NULL, $default = 10) {
  $current =& drupal_static(__FUNCTION__, array());
  if ($realm && !isset($current[$realm]) || isset($weight)) {
    $current[$realm] = isset($weight) ? $weight : $default;
    asort($current);
  }

  // This will always return ordered keys
  return array_keys($current);
}