You are here

function workflow_extensions_get_transition_label in Workflow Extensions 7

Same name and namespace in other branches
  1. 6 workflow_extensions.module \workflow_extensions_get_transition_label()

Return the name for the workflow transition identified by the supplied from-state and to-state names.

Parameters

int $wid, workflow identifier, maybe NULL (but then the combination: of $from_state_name and $to_state_name must be unique across all workflows)

string $from_state_name:

string $to_state_name:

object $node, context for token replacement; if omitted an attempt: will be made to load the node based on the nid in the URL. This will fail when creating new content, in which case a partial node must be supplied.

1 call to workflow_extensions_get_transition_label()
_workflow_extensions_replace_with_buttons in ./workflow_extensions.module

File

./workflow_extensions.module, line 589
UI-related improvements to the Workflow module and tokens for Rules.

Code

function workflow_extensions_get_transition_label($wid, $from_state_name, $to_state_name, $node = NULL) {
  if (module_exists('workflow_named_transitions')) {
    $transitions = workflow_named_transitions_get_transitions($wid);
    foreach ($transitions as $transition) {
      if ($transition->from_state == $from_state_name && $transition->to_state == $to_state_name) {
        return workflow_extensions_replace_state_name_tokens($transition->label, $to_state_name, $node);
      }
    }

    // No label defined, fall through as if module 'workflow_named_transitions'
    // wasn't installed
  }
  $tokenized_label = variable_get('workflow_extensions_change_state_button_label', '');

  // Don't think we need to check_markup(). Only users with 'administer site
  // configuration' permission can set the label pattern, so it's up to them to
  // use or not use HTML and/or javascript.
  return workflow_extensions_replace_state_name_tokens($tokenized_label, $to_state_name, $node);
}