You are here

interface WorkflowInterface in State Machine 8

Defines the interface for workflows.

Hierarchy

Expanded class hierarchy of WorkflowInterface

All classes that implement WorkflowInterface

5 files declare their use of WorkflowInterface
FulfillmentGuard.php in tests/modules/state_machine_test/src/Guard/FulfillmentGuard.php
GenericGuard.php in tests/modules/state_machine_test/src/Guard/GenericGuard.php
GuardInterface.php in src/Guard/GuardInterface.php
WorkflowManagerCacheTest.php in tests/src/Unit/WorkflowManagerCacheTest.php
WorkflowTransitionEvent.php in src/Event/WorkflowTransitionEvent.php

File

src/Plugin/Workflow/WorkflowInterface.php, line 10

Namespace

Drupal\state_machine\Plugin\Workflow
View source
interface WorkflowInterface {

  /**
   * Gets the workflow ID.
   *
   * @return string
   *   The workflow ID.
   */
  public function getId();

  /**
   * Gets the translated label.
   *
   * @return string
   *   The translated label.
   */
  public function getLabel();

  /**
   * Gets the workflow group.
   *
   * @return string
   *   The workflow group.
   */
  public function getGroup();

  /**
   * Gets the workflow states.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowState[]
   *   The states, keyed by state ID.
   */
  public function getStates();

  /**
   * Gets a workflow state with the given ID.
   *
   * @param string $id
   *   The state ID.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowState|null
   *   The requested state, or NULL if not found.
   */
  public function getState($id);

  /**
   * Gets the workflow transitions.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowTransition[]
   *   The transitions, keyed by transition ID.
   */
  public function getTransitions();

  /**
   * Gets a workflow transition with the given ID.
   *
   * @param string $id
   *   The transition ID.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowTransition|null
   *   The requested transition, or NULL if not found.
   */
  public function getTransition($id);

  /**
   * Gets the possible workflow transitions for the given state ID.
   *
   * Note that a possible transition might not be allowed (because of a guard
   * returning false).
   *
   * @param string $state_id
   *   The state ID.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowTransition[]
   *   The possible transitions, keyed by transition ID.
   */
  public function getPossibleTransitions($state_id);

  /**
   * Gets the allowed workflow transitions for the given state ID.
   *
   * @param string $state_id
   *   The state ID.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The parent entity.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowTransition[]
   *   The allowed transitions, keyed by transition ID.
   */
  public function getAllowedTransitions($state_id, EntityInterface $entity);

  /**
   * Finds the workflow transition for moving between two given states.
   *
   * @param string $from_state_id
   *   The ID of the "from" state.
   * @param string $to_state_id
   *   The ID of the "to" state.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowTransition|null
   *   The transition, or NULL if not found.
   */
  public function findTransition($from_state_id, $to_state_id);

}

Members

Namesort descending Modifiers Type Description Overrides
WorkflowInterface::findTransition public function Finds the workflow transition for moving between two given states. 1
WorkflowInterface::getAllowedTransitions public function Gets the allowed workflow transitions for the given state ID. 1
WorkflowInterface::getGroup public function Gets the workflow group. 1
WorkflowInterface::getId public function Gets the workflow ID. 1
WorkflowInterface::getLabel public function Gets the translated label. 1
WorkflowInterface::getPossibleTransitions public function Gets the possible workflow transitions for the given state ID. 1
WorkflowInterface::getState public function Gets a workflow state with the given ID. 1
WorkflowInterface::getStates public function Gets the workflow states. 1
WorkflowInterface::getTransition public function Gets a workflow transition with the given ID. 1
WorkflowInterface::getTransitions public function Gets the workflow transitions. 1