diff core/modules/content_moderation/src/StateTransitionValidationInterface.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children a9cd425dd02b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/content_moderation/src/StateTransitionValidationInterface.php	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\content_moderation;
+
+use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Session\AccountInterface;
+
+/**
+ * Validates whether a certain state transition is allowed.
+ */
+interface StateTransitionValidationInterface {
+
+  /**
+   * Gets a list of transitions that are legal for this user on this entity.
+   *
+   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
+   *   The entity to be transitioned.
+   * @param \Drupal\Core\Session\AccountInterface $user
+   *   The account that wants to perform a transition.
+   *
+   * @return \Drupal\workflows\Transition[]
+   *   The list of transitions that are legal for this user on this entity.
+   */
+  public function getValidTransitions(ContentEntityInterface $entity, AccountInterface $user);
+
+}