You are here

function workflow_url_get_workflow in Workflow 8

Helper function to determine Workflow from Workflow UI URL.

Return value

\Drupal\workflow\Entity\Workflow Workflow Object.

6 calls to workflow_url_get_workflow()
WorkflowConfigTransitionFormBase::__construct in src/Form/WorkflowConfigTransitionFormBase.php
Constructs a \Drupal\system\ConfigFormBase object.
WorkflowStateListBuilder::buildForm in src/WorkflowStateListBuilder.php
Form constructor.
WorkflowStateListBuilder::buildRow in src/WorkflowStateListBuilder.php
Builds a row for an entity in the entity listing.
WorkflowStateListBuilder::load in src/WorkflowStateListBuilder.php
Load the Transitions, and filter for Workflow type.
WorkflowStateListBuilder::submitForm in src/WorkflowStateListBuilder.php
Form submission handler.

... See full list

File

./workflow.module, line 741
Support workflows made up of arbitrary states.

Code

function workflow_url_get_workflow() {

  /** @var \Drupal\workflow\Entity\Workflow[] $workflows */
  static $workflows = [];
  $wid = workflow_url_get_parameter('workflow_type');
  if (is_object($wid)) {

    // $wid is a Workflow object.
    return $wid;
  }
  if (!isset($workflows[$wid])) {

    // $wid is a string.
    $workflows[$wid] = $wid ? Workflow::load($wid) : NULL;
  }
  return $workflows[$wid];
}