interface StateTransitionValidationInterface (View source)

Validates whether a certain state transition is allowed.

Methods

getValidTransitions(ContentEntityInterface $entity, AccountInterface $user)

Gets a list of transitions that are legal for this user on this entity.

bool
isTransitionValid(WorkflowInterface $workflow, StateInterface $original_state, StateInterface $new_state, AccountInterface $user, ContentEntityInterface $entity)

Checks if a transition between two states if valid for the given user.

Details

Transition[] getValidTransitions(ContentEntityInterface $entity, AccountInterface $user)

Gets a list of transitions that are legal for this user on this entity.

Parameters

ContentEntityInterface $entity

The entity to be transitioned.

AccountInterface $user

The account that wants to perform a transition.

Return Value

Transition[]

The list of transitions that are legal for this user on this entity.

bool isTransitionValid(WorkflowInterface $workflow, StateInterface $original_state, StateInterface $new_state, AccountInterface $user, ContentEntityInterface $entity)

Checks if a transition between two states if valid for the given user.

Parameters

WorkflowInterface $workflow

The workflow entity.

StateInterface $original_state

The original workflow state.

StateInterface $new_state

The new workflow state.

AccountInterface $user

The user to validate.

ContentEntityInterface $entity

The entity to be transitioned.

Return Value

bool

Returns TRUE if transition is valid, otherwise FALSE.