$this->workflowRegistry =
$workflowRegistry;
} public function getFunctions(): array
{ return [ new TwigFunction('workflow_can',
$this->
canTransition(...
)),
new TwigFunction('workflow_transitions',
$this->
getEnabledTransitions(...
)),
new TwigFunction('workflow_transition',
$this->
getEnabledTransition(...
)),
new TwigFunction('workflow_has_marked_place',
$this->
hasMarkedPlace(...
)),
new TwigFunction('workflow_marked_places',
$this->
getMarkedPlaces(...
)),
new TwigFunction('workflow_metadata',
$this->
getMetadata(...
)),
new TwigFunction('workflow_transition_blockers',
$this->
buildTransitionBlockerList(...
)),
];
} /**
* Returns true if the transition is enabled.
*/
public function canTransition(object
$subject, string
$transitionName, string
$name = null
): bool
{ return $this->workflowRegistry->
get($subject,
$name)->
can($subject,
$transitionName);
}