You are here

function environment_drush_render_current in Environment 6

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

Render all current environment states with full description.

Parameters

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

Return value

Array of strings describing the environment(s).

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

File

./environment.drush.inc, line 123
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();
  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;
}