You are here

function Workflow::getOptions in Workflow 7

Parameters

bool $grouped: Indicates if the value must be grouped per workflow. This influence the rendering of the select_list options.

Return value

All states in a Workflow, as an array of $key => $label.

File

includes/Entity/Workflow.php, line 307
Contains workflow\includes\Entity\Workflow.

Class

Workflow
@file Contains workflow\includes\Entity\Workflow.

Code

function getOptions($grouped = FALSE) {
  $options = array();
  foreach ($this
    ->getStates() as $state) {
    $options[$state
      ->value()] = check_plain($state
      ->label());
  }
  if ($grouped) {

    // make a group for each Workflow.
    $label = check_plain($this
      ->label());
    $grouped_options[$label] = $options;
    return $grouped_options;
  }
  return $options;
}