You are here

function environment_current in Environment 8

Same name and namespace in other branches
  1. 6 environment.module \environment_current()
  2. 7 environment.module \environment_current()

Gets the current environment.

Parameters

string $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.

string $default: Optional; defaults to NULL. Specify the default value if the current environment cannot be identified.

bool $load: (default: FALSE) If TRUE, loads the full environment definition.

Return value

object environment object

4 calls to environment_current()
EnvironmentAdminSettings::buildForm in src/Form/EnvironmentAdminSettings.php
Form constructor.
EnvironmentSubscriber::checkForEnvironmentSwitch in src/EventSubscriber/EnvironmentSubscriber.php
environment_requirements in ./environment.install
Implements hook_requirements().
environment_switch in ./environment.module
Switches between two environments.

File

./environment.module, line 85
Module for handling changes in server environments

Code

function environment_current($load = FALSE) {
  $current = \Drupal::config('environment.settings')
    ->get('environment');
  return $load ? environment_load($current) : $current;
}