You are here

function _environment_state_options in Environment 7

Same name and namespace in other branches
  1. 6 environment.module \_environment_state_options()

Provides environment form options.

Parameters

string $workflow: Optional; specify the workflow for specific options. Defaults to states that are not part of an explicit workflow.

string $prefix: Optional; prefix the environment label with the specified string. Defaults to no prefix.

bool $reset: Optional; reset the static cache.

Return value

array Array of form options in the style of environment => label

2 calls to _environment_state_options()
environment_admin_settings in ./environment.admin.inc
Environment admin form.
_environment_state_options_all in ./environment.module
Build an options widget with all workflows.

File

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

Code

function _environment_state_options($workflow = 'default', $prefix = '', $reset = FALSE) {
  static $options;
  if (empty($options) || $reset) {
    $environments = environment_load();
    foreach ($environments as $name => $state) {
      $options[$state['workflow']][$name] = $prefix . $state['label'];
    }
  }
  return empty($options[$workflow]) ? array() : $options[$workflow];
}