Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. StateTransitionValidationInterface.php

interface StateTransitionValidationInterface

Validates whether a certain state transition is allowed.

Hierarchy

  • interface \Drupal\content_moderation\StateTransitionValidationInterface

Expanded class hierarchy of StateTransitionValidationInterface

All classes that implement StateTransitionValidationInterface

3 files declare their use of StateTransitionValidationInterface
EntityModerationForm.php in core/modules/content_moderation/src/Form/EntityModerationForm.php
ModerationStateConstraintValidator.php in core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php
ModerationStateWidget.php in core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php

File

core/modules/content_moderation/src/StateTransitionValidationInterface.php, line 13

Namespace

Drupal\content_moderation
View source
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);
    
    /**
     * Checks if a transition between two states if valid for the given user.
     *
     * @param \Drupal\workflows\WorkflowInterface $workflow
     *   The workflow entity.
     * @param \Drupal\workflows\StateInterface $original_state
     *   The original workflow state.
     * @param \Drupal\workflows\StateInterface $new_state
     *   The new workflow state.
     * @param \Drupal\Core\Session\AccountInterface $user
     *   The user to validate.
     * @param \Drupal\Core\Entity\ContentEntityInterface $entity
     *   The entity to be transitioned.
     *
     * @return bool
     *   Returns TRUE if transition is valid, otherwise FALSE.
     */
    public function isTransitionValid(WorkflowInterface $workflow, StateInterface $original_state, StateInterface $new_state, AccountInterface $user, ContentEntityInterface $entity);

}

Members

Title Sort descending Modifiers Object type Summary
StateTransitionValidationInterface::getValidTransitions public function Gets a list of transitions that are legal for this user on this entity.
StateTransitionValidationInterface::isTransitionValid public function Checks if a transition between two states if valid for the given user.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal