Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\content_moderation;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Entity\ContentEntityInterface;
|
Chris@0
|
6 use Drupal\Core\Session\AccountInterface;
|
Chris@17
|
7 use Drupal\workflows\StateInterface;
|
Chris@17
|
8 use Drupal\workflows\WorkflowInterface;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Validates whether a certain state transition is allowed.
|
Chris@0
|
12 */
|
Chris@0
|
13 interface StateTransitionValidationInterface {
|
Chris@0
|
14
|
Chris@0
|
15 /**
|
Chris@0
|
16 * Gets a list of transitions that are legal for this user on this entity.
|
Chris@0
|
17 *
|
Chris@0
|
18 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
19 * The entity to be transitioned.
|
Chris@0
|
20 * @param \Drupal\Core\Session\AccountInterface $user
|
Chris@0
|
21 * The account that wants to perform a transition.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @return \Drupal\workflows\Transition[]
|
Chris@0
|
24 * The list of transitions that are legal for this user on this entity.
|
Chris@0
|
25 */
|
Chris@0
|
26 public function getValidTransitions(ContentEntityInterface $entity, AccountInterface $user);
|
Chris@0
|
27
|
Chris@17
|
28 /**
|
Chris@17
|
29 * Checks if a transition between two states if valid for the given user.
|
Chris@17
|
30 *
|
Chris@17
|
31 * @param \Drupal\workflows\WorkflowInterface $workflow
|
Chris@17
|
32 * The workflow entity.
|
Chris@17
|
33 * @param \Drupal\workflows\StateInterface $original_state
|
Chris@17
|
34 * The original workflow state.
|
Chris@17
|
35 * @param \Drupal\workflows\StateInterface $new_state
|
Chris@17
|
36 * The new workflow state.
|
Chris@17
|
37 * @param \Drupal\Core\Session\AccountInterface $user
|
Chris@17
|
38 * The user to validate.
|
Chris@17
|
39 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@17
|
40 * (optional) The entity to be transitioned. Omitting this parameter is
|
Chris@17
|
41 * deprecated and will be required in Drupal 9.0.0.
|
Chris@17
|
42 *
|
Chris@17
|
43 * @return bool
|
Chris@17
|
44 * Returns TRUE if transition is valid, otherwise FALSE.
|
Chris@17
|
45 */
|
Chris@17
|
46 public function isTransitionValid(WorkflowInterface $workflow, StateInterface $original_state, StateInterface $new_state, AccountInterface $user, ContentEntityInterface $entity = NULL);
|
Chris@17
|
47
|
Chris@0
|
48 }
|