class Transition

Same name in other branches
  1. 9 core/modules/workflows/src/Transition.php \Drupal\workflows\Transition
  2. 8.9.x core/modules/workflows/src/Transition.php \Drupal\workflows\Transition
  3. 10 core/modules/workflows/src/Transition.php \Drupal\workflows\Transition

A transition value object that describes the transition between states.

Hierarchy

  • class \Drupal\workflows\Transition implements \Drupal\workflows\TransitionInterface

Expanded class hierarchy of Transition

5 files declare their use of Transition
EntityModerationForm.php in core/modules/content_moderation/src/Form/EntityModerationForm.php
StateTransitionValidation.php in core/modules/content_moderation/src/StateTransitionValidation.php
TransitionTest.php in core/modules/workflows/tests/src/Unit/TransitionTest.php
WorkflowTest.php in core/modules/workflows/tests/src/Unit/WorkflowTest.php
WorkflowTypeBase.php in core/modules/workflows/src/Plugin/WorkflowTypeBase.php
7 string references to 'Transition'
ComplexTestTypeTransitionForm::buildConfigurationForm in core/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeTransitionForm.php
WorkflowStateEditForm::form in core/modules/workflows/src/Form/WorkflowStateEditForm.php
WorkflowTransitionAddForm::save in core/modules/workflows/src/Form/WorkflowTransitionAddForm.php
WorkflowTransitionEditForm::form in core/modules/workflows/src/Form/WorkflowTransitionEditForm.php
WorkflowTransitionEditForm::save in core/modules/workflows/src/Form/WorkflowTransitionEditForm.php

... See full list

File

core/modules/workflows/src/Transition.php, line 8

Namespace

Drupal\workflows
View source
class Transition implements TransitionInterface {
    
    /**
     * The workflow that this transition is attached to.
     *
     * @var \Drupal\workflows\WorkflowTypeInterface
     */
    protected $workflow;
    
    /**
     * The transition's ID.
     *
     * @var string
     */
    protected $id;
    
    /**
     * The transition's label.
     *
     * @var string
     */
    protected $label;
    
    /**
     * The transition's from state IDs.
     *
     * @var string[]
     */
    protected $fromStateIds;
    
    /**
     * The transition's to state ID.
     *
     * @var string
     */
    protected $toStateId;
    
    /**
     * The transition's weight.
     *
     * @var int
     */
    protected $weight;
    
    /**
     * Transition constructor.
     *
     * @param \Drupal\workflows\WorkflowTypeInterface $workflow
     *   The workflow the state is attached to.
     * @param string $id
     *   The transition's ID.
     * @param string $label
     *   The transition's label.
     * @param array $from_state_ids
     *   A list of from state IDs.
     * @param string $to_state_id
     *   The to state ID.
     * @param int $weight
     *   (optional) The transition's weight. Defaults to 0.
     */
    public function __construct(WorkflowTypeInterface $workflow, $id, $label, array $from_state_ids, $to_state_id, $weight = 0) {
        $this->workflow = $workflow;
        $this->id = $id;
        $this->label = $label;
        $this->fromStateIds = $from_state_ids;
        $this->toStateId = $to_state_id;
        $this->weight = $weight;
    }
    
    /**
     * {@inheritdoc}
     */
    public function id() {
        return $this->id;
    }
    
    /**
     * {@inheritdoc}
     */
    public function label() {
        return $this->label;
    }
    
    /**
     * {@inheritdoc}
     */
    public function from() {
        return $this->workflow
            ->getStates($this->fromStateIds);
    }
    
    /**
     * {@inheritdoc}
     */
    public function to() {
        return $this->workflow
            ->getState($this->toStateId);
    }
    
    /**
     * {@inheritdoc}
     */
    public function weight() {
        return $this->weight;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Transition::$fromStateIds protected property The transition's from state IDs.
Transition::$id protected property The transition's ID.
Transition::$label protected property The transition's label.
Transition::$toStateId protected property The transition's to state ID.
Transition::$weight protected property The transition's weight.
Transition::$workflow protected property The workflow that this transition is attached to.
Transition::from public function Overrides TransitionInterface::from
Transition::id public function Overrides TransitionInterface::id
Transition::label public function Overrides TransitionInterface::label
Transition::to public function Overrides TransitionInterface::to
Transition::weight public function Overrides TransitionInterface::weight
Transition::__construct public function Transition constructor.
TransitionInterface::DIRECTION_FROM constant The transition direction from.
TransitionInterface::DIRECTION_TO constant The transition direction to.
TransitionInterface::PLUGIN_FORM_KEY constant The key of the transition plugin form.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.