You are here

function workflow_rules_check_transition_label in Workflow 6.2

Same name and namespace in other branches
  1. 6 workflow_rules/workflow_rules.module \workflow_rules_check_transition_label()

Label callback for check transition condition.

File

workflow_rules/workflow_rules.module, line 150
Rules integration for the Workflow module

Code

function workflow_rules_check_transition_label($settings, $argument_labels) {
  if (in_array('ANY', $settings['from_state'])) {
    $settings['from_state'] = array(
      'ANY',
    );
  }
  if (in_array('ANY', $settings['to_state'])) {
    $settings['to_state'] = array(
      'ANY',
    );
  }
  $from = array();
  $to = array();
  foreach ($settings['from_state'] as $state) {
    if ($state != 'ANY') {
      $fromtemp = workflow_get_state($state);
      $from[] = $fromtemp['state'];
    }
    else {
      $from[] = t('Any state');
    }
  }
  foreach ($settings['to_state'] as $state) {
    if ($state != 'ANY') {
      $totemp = workflow_get_state($state);
      $to[] = $totemp['state'];
    }
    else {
      $to[] = t('Any state');
    }
  }
  return t('Check workflow transition from @from to @to', array(
    '@from' => implode(', ', $from),
    '@to' => implode(', ', $to),
  ));
}