private function WorkflowTransitionRevertForm::getUrl in Workflow 8
Returns the URL for a Transition.
Parameters
\Drupal\workflow\Entity\WorkflowTransitionInterface $transition: Transition object.
Return value
\Drupal\Core\Url The Transition's URL.
2 calls to WorkflowTransitionRevertForm::getUrl()
- WorkflowTransitionRevertForm::getCancelUrl in src/
Form/ WorkflowTransitionRevertForm.php - Returns the route to go to if the user cancels the action.
- WorkflowTransitionRevertForm::submitForm in src/
Form/ WorkflowTransitionRevertForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
File
- src/
Form/ WorkflowTransitionRevertForm.php, line 141
Class
- WorkflowTransitionRevertForm
- Implements a form to revert an entity to a previous state.
Namespace
Drupal\workflow\FormCode
private function getUrl(WorkflowTransitionInterface $transition) {
$route_provider = \Drupal::service('router.route_provider');
if (count($route_provider
->getRoutesByNames([
'entity.node.workflow_history',
])) === 1) {
$url = new Url('entity.node.workflow_history', [
'node' => $transition
->getTargetEntityId(),
'field_name' => $transition
->getFieldName(),
]);
}
else {
$entity = $transition
->getTargetEntity();
$url = new Url($transition
->getTargetEntity()
->toUrl()
->getRouteName(), [
$entity
->getEntityTypeId() => $transition
->getTargetEntityId(),
'field_name' => $transition
->getFieldName(),
]);
}
return $url;
}