annotate core/modules/content_moderation/src/StateTransitionValidationInterface.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
rev   line source
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@4 7 use Drupal\workflows\StateInterface;
Chris@4 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@4 28 /**
Chris@4 29 * Checks if a transition between two states if valid for the given user.
Chris@4 30 *
Chris@4 31 * @param \Drupal\workflows\WorkflowInterface $workflow
Chris@4 32 * The workflow entity.
Chris@4 33 * @param \Drupal\workflows\StateInterface $original_state
Chris@4 34 * The original workflow state.
Chris@4 35 * @param \Drupal\workflows\StateInterface $new_state
Chris@4 36 * The new workflow state.
Chris@4 37 * @param \Drupal\Core\Session\AccountInterface $user
Chris@4 38 * The user to validate.
Chris@4 39 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
Chris@4 40 * (optional) The entity to be transitioned. Omitting this parameter is
Chris@4 41 * deprecated and will be required in Drupal 9.0.0.
Chris@4 42 *
Chris@4 43 * @return bool
Chris@4 44 * Returns TRUE if transition is valid, otherwise FALSE.
Chris@4 45 */
Chris@4 46 public function isTransitionValid(WorkflowInterface $workflow, StateInterface $original_state, StateInterface $new_state, AccountInterface $user, ContentEntityInterface $entity = NULL);
Chris@4 47
Chris@0 48 }