You are here

protected function Workflow::isTransitionAllowed in State Machine 8

Gets whether the given transition is allowed.

Parameters

\Drupal\state_machine\Plugin\Workflow\WorkflowTransition $transition: The transition.

\Drupal\Core\Entity\EntityInterface $entity: The parent entity.

Return value

bool TRUE if the transition is allowed, FALSE otherwise.

1 call to Workflow::isTransitionAllowed()
Workflow::getAllowedTransitions in src/Plugin/Workflow/Workflow.php
Gets the allowed workflow transitions for the given state ID.

File

src/Plugin/Workflow/Workflow.php, line 184

Class

Workflow
Defines the class for workflows.

Namespace

Drupal\state_machine\Plugin\Workflow

Code

protected function isTransitionAllowed(WorkflowTransition $transition, EntityInterface $entity) {
  foreach ($this->guardFactory
    ->get($this
    ->getGroup()) as $guard) {
    if ($guard
      ->allowed($transition, $this, $entity) === FALSE) {
      return FALSE;
    }
  }
  return TRUE;
}