You are here

function environment_drush_render_environment in Environment 6

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

Render the specified environment definition as a descriptive one-liner.

Parameters

$state: Array defining an environment state.

$show_workflow: Optional; default to TRUE. If there are more than one workflows defined in the system, will prefix the return with the workflow's label. If set to FALSE this is skipped. This is separate from $verbose because you could want a verbose description in a workflow-specific context.

$verbose: Optional; defaults to FALSE. If TRUE, will include the environment description.

Return value

String describing the specified environment.

2 calls to environment_drush_render_environment()
drush_environment_switch in ./environment.drush.inc
Implementation of drush_hook_COMMAND for environment_switch.
environment_drush_render_current in ./environment.drush.inc
Render all current environment states with full description.

File

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

Code

function environment_drush_render_environment($state, $show_workflow = TRUE, $verbose = FALSE) {
  $description = $verbose && isset($state['description']) ? ': ' . $state['description'] : '';
  $prefix = '';
  if ($show_workflow) {
    $workflows = environment_workflow_load();
    $prefix .= count($workflows) > 1 ? $workflows[$state['workflow']]['label'] . ' : ' : '';
  }
  return $prefix . $state['label'] . ' (' . $state['name'] . ')' . $description;
}