function environment_current in Environment 6
Same name and namespace in other branches
- 8 environment.module \environment_current()
- 7 environment.module \environment_current()
Gets the current environment.
Parameters
$workflow: (default: default) Specify an environment workflow to check. If NULL, will return the current environment state for each workflow. Default workflow will check environment states not assigned an explicit workflow, this maintains backwards compatibility.
$default: Optional; defaults to NULL. Specify the default value if the current environment cannot be identified.
$load: (default: FALSE) If TRUE, loads the full environment definition.
5 calls to environment_current()
- environment_admin_settings in ./
environment.admin.inc - @file Settings for Environment module
- environment_allowed in ./
environment.module - Check if something is allowed in the current environment.
- environment_force_init in modules/
environment_force/ environment_force.module - Implementation of hook_init().
- environment_switch in ./
environment.module - Switches between two environments.
- environment_token_values in plugins/
environment.token.inc - Implementation of hook_token_values().
File
- ./
environment.module, line 185
Code
function environment_current($workflow = 'default', $default = NULL, $load = FALSE) {
$current = variable_get('environment', array());
if (!is_array($current)) {
$current = array(
'default' => $current,
);
}
if (is_null($workflow)) {
$current = empty($current) ? $default : $current;
return $load ? environment_load($current) : $current;
}
elseif (isset($current[$workflow])) {
$current[$workflow] = empty($current[$workflow]) ? $default : $current[$workflow];
return $load ? environment_load($current[$workflow]) : $current[$workflow];
}
return $default;
}