You are here

function environment_drush_render_current in Environment 7

Same name and namespace in other branches
  1. 6 environment.drush.inc \environment_drush_render_current()

Render all current environment states with full description.

Parameters

string $workflow: Optional; specify a single workflow whose environment to check. Otherwise show all states.

Return value

array Array of strings describing the environment(s).

1 call to environment_drush_render_current()
drush_environment_show in ./environment.drush.inc
Implements drush_hook_COMMAND for environment.

File

./environment.drush.inc, line 129
Executes the environment_switch capabilities.

Code

function environment_drush_render_current($workflow = NULL) {
  $environments = (array) variable_get('environment', array());
  foreach ($environments as $environment) {
    $states[] = environment_load($environment);
  }
  $items = array();
  if (empty($states)) {
    drush_log('Your site environment is not set.', 'warning');
  }
  else {
    foreach ($states as $state) {
      if (is_null($workflow) || $state['workflow'] == $workflow) {
        if (!drush_get_context('DRUSH_PIPE')) {
          $items[] = array(
            environment_drush_render_environment($state, is_null($workflow), TRUE),
          );
        }
        else {
          $items[] = $state['name'];
        }
      }
    }
  }
  return $items;
}