function environment_load in Environment 8
Same name and namespace in other branches
- 6 environment.module \environment_load()
- 7 environment.module \environment_load()
Fetches all available environments.
Parameters
string $env: (optional) Name of the environment. If NULL, will return all environments. If an array, will return all environments specified in the array.
bool $reset: (default: FALSE) Reset the static cache and collect new data.
Return value
array Return all environments or the specified environment.
7 calls to environment_load()
- drush_environment_current in ./
environment.drush.inc - Implements drush_hook_COMMAND for environment.
- drush_environment_list in ./
environment.drush.inc - Implements drush_hook_COMMAND for environment.
- drush_environment_switch in ./
environment.drush.inc - Implements drush_hook_COMMAND for environment_switch.
- drush_environment_switch_validate in ./
environment.drush.inc - Implements drush_hook_COMMAND_validate() for environment_switch.
- environment_current in ./
environment.module - Gets the current environment.
File
- ./
environment.module, line 115 - Module for handling changes in server environments
Code
function environment_load($env = NULL, $reset = FALSE) {
static $environments;
if (!isset($environments) || $reset) {
$environments = \Drupal::entityManager()
->getStorage('environment')
->loadMultiple();
}
if (empty($env)) {
return $environments;
}
else {
return isset($environments[$env]) ? $environments[$env] : FALSE;
}
}