You are here

function workflow_url_get_operation in Workflow 8

Helper function to get the entity from a route.

Return value

mixed|string Return $operation

1 call to workflow_url_get_operation()
WorkflowTransitionBlock::blockAccess in src/Plugin/Block/WorkflowTransitionBlock.php
Indicates whether the block should be shown.

File

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

Code

function workflow_url_get_operation() {
  $url = Url::fromRoute('<current>');

  // The last part of the path is the operation: edit, workflow, devel.
  $url_parts = explode('/', $url
    ->toString());
  $operation = array_pop($url_parts);

  // Except for view pages.
  if (is_numeric($operation) || $operation == 'view') {
    $operation = '';
  }
  return $operation;
}