You are here

private function WorkflowItem::_allowed_values_string in Workflow 7

Same name and namespace in other branches
  1. 7.2 includes/Field/WorkflowItem.php \WorkflowItem::_allowed_values_string()
1 call to WorkflowItem::_allowed_values_string()
WorkflowItem::settingsForm in includes/Field/WorkflowItem.php

File

includes/Field/WorkflowItem.php, line 370
Contains workflow\includes\Field\WorkflowItem.

Class

WorkflowItem
Plugin implementation of the 'workflow' field type.

Code

private function _allowed_values_string($wid = 0) {
  $lines = array();
  $states = WorkflowState::getStates(0, $wid);
  $previous_wid = -1;
  foreach ($states as $state) {

    // Only show enabled states.
    if ($state->status) {

      // Show a Workflow name between Workflows, if more then 1 in the list.
      if ($wid == 0 && $previous_wid != $state->wid) {
        $previous_wid = $state->wid;
        $lines[] = $state->name . "'s states: ";
      }
      $label = t($state
        ->label());
      $states[$state->sid] = check_plain($label);
      $lines[] = $state->sid . ' | ' . check_plain($label);
    }
  }
  return implode("\n", $lines);
}