You are here

public function WorkflowTransition::isRevertable in Workflow 8

Returns if this is a revertable Transition on the History tab.

Return value

bool

Overrides WorkflowTransitionInterface::isRevertable

File

src/Entity/WorkflowTransition.php, line 808

Class

WorkflowTransition
Implements an actual, executed, Transition.

Namespace

Drupal\workflow\Entity

Code

public function isRevertable() {

  // Some states are useless to revert.
  if ($this
    ->getFromSid() == $this
    ->getToSid()) {
    return FALSE;
  }

  // Some states are not fit to revert to.
  $from_state = $this
    ->getFromState();
  if (!$from_state || !$from_state
    ->isActive() || $from_state
    ->isCreationState()) {
    return FALSE;
  }
  return TRUE;
}