use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Session\AccountInterface;
+use Drupal\workflows\StateInterface;
use Drupal\workflows\Transition;
+use Drupal\workflows\WorkflowInterface;
/**
* Validates whether a certain state transition is allowed.
});
}
+ /**
+ * {@inheritdoc}
+ */
+ public function isTransitionValid(WorkflowInterface $workflow, StateInterface $original_state, StateInterface $new_state, AccountInterface $user) {
+ $transition = $workflow->getTypePlugin()->getTransitionFromStateToState($original_state->id(), $new_state->id());
+ return $user->hasPermission('use ' . $workflow->id() . ' transition ' . $transition->id());
+ }
+
}