You are here

function _environment_state_options in Environment 6

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

Provides environment form options.

Parameters

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

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

$reset: Optional; reset the static cache.

Return value

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

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

File

./environment.module, line 299

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];
}