class WorkflowTransition in Workflow 8
Implements an actual, executed, Transition.
If a transition is executed, the new state is saved in the Field. If a transition is saved, it is saved in table {workflow_transition_history}.
Plugin annotation
@ContentEntityType(
id = "workflow_transition",
label = @Translation("Workflow transition"),
label_singular = @Translation("Workflow transition"),
label_plural = @Translation("Workflow transitions"),
label_count = @PluralTranslation(
singular = "@count Workflow transition",
plural = "@count Workflow transitions",
),
bundle_label = @Translation("Workflow type"),
module = "workflow",
translatable = FALSE,
handlers = {
"access" = "Drupal\workflow\WorkflowAccessControlHandler",
"list_builder" = "Drupal\workflow\WorkflowTransitionListBuilder",
"form" = {
"add" = "Drupal\workflow\Form\WorkflowTransitionForm",
"delete" = "Drupal\Core\Entity\EntityDeleteForm",
"edit" = "Drupal\workflow\Form\WorkflowTransitionForm",
"revert" = "Drupal\workflow\Form\WorkflowTransitionRevertForm",
},
"views_data" = "Drupal\workflow\WorkflowTransitionViewsData",
},
base_table = "workflow_transition_history",
entity_keys = {
"id" = "hid",
"bundle" = "wid",
"langcode" = "langcode",
},
permission_granularity = "bundle",
bundle_entity_type = "workflow_type",
field_ui_base_route = "entity.workflow_type.edit_form",
links = {
"canonical" = "/workflow_transition/{workflow_transition}",
"delete-form" = "/workflow_transition/{workflow_transition}/delete",
"edit-form" = "/workflow_transition/{workflow_transition}/edit",
"revert-form" = "/workflow_transition/{workflow_transition}/revert",
},
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements EntityInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
- class \Drupal\workflow\Entity\WorkflowTransition implements WorkflowTransitionInterface uses MessengerTrait, StringTranslationTrait, WorkflowTypeAttributeTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
Expanded class hierarchy of WorkflowTransition
7 files declare their use of WorkflowTransition
- workflow.module in ./
workflow.module - Support workflows made up of arbitrary states.
- WorkflowDefaultWidget.php in src/
Plugin/ Field/ FieldWidget/ WorkflowDefaultWidget.php - WorkflowStateActionBase.php in src/
Plugin/ Action/ WorkflowStateActionBase.php - WorkflowStateHistoryFormatter.php in src/
Plugin/ Field/ FieldFormatter/ WorkflowStateHistoryFormatter.php - WorkflowTransitionListBuilder.php in src/
WorkflowTransitionListBuilder.php
File
- src/
Entity/ WorkflowTransition.php, line 63
Namespace
Drupal\workflow\EntityView source
class WorkflowTransition extends ContentEntityBase implements WorkflowTransitionInterface {
/*
* Adds the messenger trait.
*/
use MessengerTrait;
/*
* Adds the translation trait.
*/
use StringTranslationTrait;
/*
* Adds variables and get/set methods for Workflow property.
*/
use WorkflowTypeAttributeTrait;
/*
* Transition data: are provided via baseFieldDefinitions().
*/
/*
* Cache data.
*/
/**
* @var \Drupal\Core\Entity\EntityInterface
*
* @usage Use WorkflowTransition->getTargetEntity() to fetch this.
*/
protected $entity = NULL;
/**
* @var \Drupal\user\UserInterface
*
* @usage Use WorkflowTransition->getOwner() to fetch this.
*/
protected $user = NULL;
/**
* Extra data: describe the state of the transition.
*
* @var bool
*/
protected $isScheduled = FALSE;
/**
* Extra data: describe the state of the transition.
*
* @var bool
*/
protected $isExecuted = FALSE;
/**
* Extra data: describe the state of the transition.
*
* @var bool
*/
protected $isForced = FALSE;
/**
* Entity class functions.
*/
/**
* Creates a new entity.
*
* @param array $values
* @param string $entityType
* The entity type of this Entity subclass.
* @param bool $bundle
* @param array $translations
*
* @see entity_create()
*
* No arguments passed, when loading from DB.
* All arguments must be passed, when creating an object programmatically.
* One argument $entity may be passed, only to directly call delete() afterwards.
*/
public function __construct(array $values = [], $entityType = 'workflow_transition', $bundle = FALSE, array $translations = []) {
// Please be aware that $entity_type and $entityType are different things!
parent::__construct($values, $entityType, $bundle, $translations);
// This transition is not scheduled.
$this->isScheduled = FALSE;
// This transition is not executed, if it has no hid, yet, upon load.
$this->isExecuted = $this
->id() > 0;
}
/**
* {@inheritdoc}
*
* @param array $values
* $values[0] may contain a Workflow object or State object or State ID.
*
* @return static
* The entity object.
*/
public static function create(array $values = []) {
if (is_array($values) && isset($values[0])) {
$value = $values[0];
$state = NULL;
if (is_string($value)) {
$state = WorkflowState::load($value);
}
elseif (is_object($value) && $value instanceof WorkflowState) {
$state = $value;
}
$values['wid'] = $state ? $state
->getWorkflowId() : '';
$values['from_sid'] = $state ? $state
->id() : '';
}
// Add default values.
$values += [
'timestamp' => \Drupal::time()
->getRequestTime(),
'uid' => \Drupal::currentUser()
->id(),
];
return parent::create($values);
}
/**
* {@inheritdoc}
*/
public function setValues($to_sid, $uid = NULL, $timestamp = NULL, $comment = '', $force_create = FALSE) {
// Normally, the values are passed in an array, and set in parent::__construct, but we do it ourselves.
$uid = $uid === NULL ? workflow_current_user()
->id() : $uid;
$from_sid = $this
->getFromSid();
$this
->set('to_sid', $to_sid);
$this
->setOwnerId($uid);
$this
->setTimestamp($timestamp == NULL ? \Drupal::time()
->getRequestTime() : $timestamp);
$this
->setComment($comment);
// If constructor is called with new() and arguments.
if (!$from_sid && !$to_sid && !$this
->getTargetEntity()) {
// If constructor is called without arguments, e.g., loading from db.
}
elseif ($from_sid && $this
->getTargetEntity()) {
// Caveat: upon entity_delete, $to_sid is '0'.
// If constructor is called with new() and arguments.
}
elseif (!$from_sid) {
// Not all parameters are passed programmatically.
if (!$force_create) {
$this
->messenger()
->addError($this
->t('Wrong call to constructor Workflow*Transition(%from_sid to %to_sid)', [
'%from_sid' => $from_sid,
'%to_sid' => $to_sid,
]));
}
}
return $this;
}
/**
* CRUD functions.
*/
/**
* Saves the entity.
*
* Mostly, you'd better use WorkflowTransitionInterface::execute().
*
* {@inheritdoc}
*/
public function save() {
// Set Target Entity, to be used by Rules.
/** @var \Drupal\workflow\Entity\WorkflowTransitionInterface $reference */
$reference = $this
->get('entity_id')
->first();
if ($reference) {
$reference
->set('entity', $this
->getTargetEntity());
}
// Avoid custom actions for subclass WorkflowScheduledTransition.
if ($this
->isScheduled()) {
return parent::save();
}
if ($this
->getEntityTypeId() != 'workflow_transition') {
return parent::save();
}
$transition = $this;
$entity_type = $transition
->getTargetEntityTypeId();
$entity_id = $transition
->getTargetEntityId();
$field_name = $transition
->getFieldName();
// Remove any scheduled state transitions.
foreach (WorkflowScheduledTransition::loadMultipleByProperties($entity_type, [
$entity_id,
], [], $field_name) as $scheduled_transition) {
/** @var \Drupal\workflow\Entity\WorkflowTransitionInterface $scheduled_transition */
$scheduled_transition
->delete();
}
// Check for no transition.
if ($this
->isEmpty()) {
return SAVED_UPDATED;
}
// Update the transition, if already exists.
if ($this
->id()) {
return parent::save();
}
// Insert the transition. Make sure it hasn't already been inserted.
// @todo Allow a scheduled transition per revision.
// @todo Allow a state per language version (langcode).
$found_transition = self::loadByProperties($entity_type, $entity_id, [], $field_name);
if ($found_transition && $found_transition
->getTimestamp() == \Drupal::time()
->getRequestTime() && $found_transition
->getToSid() == $this
->getToSid()) {
return SAVED_UPDATED;
}
return parent::save();
}
/**
* {@inheritdoc}
*/
public static function loadByProperties($entity_type, $entity_id, array $revision_ids = [], $field_name = '', $langcode = '', $sort = 'ASC', $transition_type = 'workflow_transition') {
$limit = 1;
$transitions = self::loadMultipleByProperties($entity_type, [
$entity_id,
], $revision_ids, $field_name, $langcode, $limit, $sort, $transition_type);
if ($transitions) {
$transition = reset($transitions);
return $transition;
}
return NULL;
}
/**
* {@inheritdoc}
*/
public static function loadMultipleByProperties($entity_type, array $entity_ids, array $revision_ids = [], $field_name = '', $langcode = '', $limit = NULL, $sort = 'ASC', $transition_type = 'workflow_transition') {
/** @var \Drupal\Core\Entity\Query\QueryInterface $query */
$query = \Drupal::entityQuery($transition_type)
->condition('entity_type', $entity_type)
->sort('timestamp', $sort)
->addTag($transition_type);
if (!empty($entity_ids)) {
$query
->condition('entity_id', $entity_ids, 'IN');
}
if (!empty($revision_ids)) {
$query
->condition('revision_id', $entity_ids, 'IN');
}
if ($field_name != '') {
$query
->condition('field_name', $field_name, '=');
}
if ($langcode != '') {
$query
->condition('langcode', $langcode, '=');
}
if ($limit) {
$query
->range(0, $limit);
}
if ($transition_type == 'workflow_transition') {
$query
->sort('hid', 'DESC');
}
$ids = $query
->execute();
$transitions = self::loadMultiple($ids);
return $transitions;
}
/**
* Implementing interface WorkflowTransitionInterface - properties.
*/
/**
* Determines if the Transition is valid and can be executed.
*
* @todo Add to isAllowed() ?
* @todo Add checks to WorkflowTransitionElement ?
*
* @return bool
*/
public function isValid() {
// Load the entity, if not already loaded.
// This also sets the (empty) $revision_id in Scheduled Transitions.
$entity = $this
->getTargetEntity();
if (!$entity) {
// @todo There is a watchdog error, but no UI-error. Is this OK?
$message = 'User tried to execute a Transition without an entity.';
$this
->logError($message);
return FALSE;
// <-- exit !!!
}
if (!$this
->getFromState()) {
// @todo The page is not correctly refreshed after this error.
$message = $this
->t('You tried to set a Workflow State, but
the entity is not relevant. Please contact your system administrator.');
$this
->messenger()
->addError($message);
$message = 'Setting a non-relevant Entity from state %sid1 to %sid2';
$this
->logError($message);
return FALSE;
// <-- exit !!!
}
// The transition is OK.
return TRUE;
}
/**
* Check if anything has changed in this transition.
*
* @return bool
*/
protected function isEmpty() {
if ($this
->getToSid() != $this
->getFromSid()) {
return FALSE;
}
if ($this
->getComment()) {
return FALSE;
}
$fields = WorkflowManager::getAttachedFields('workflow_transition', $this
->bundle());
/** @var \Drupal\Core\Field\Entity\BaseFieldOverride $field */
foreach ($fields as $field_name => $field) {
if (!$this->{$field_name}
->isEmpty()) {
return FALSE;
}
}
return TRUE;
}
/**
* {@inheritdoc}
*/
public function isAllowed(UserInterface $user, $force = FALSE) {
if ($force) {
// $force allows Rules to cause transition.
return TRUE;
}
// @todo Keep below code aligned between WorkflowState, ~Transition, ~HistoryAccess
/*
* Get user's permissions.
*/
$type_id = $this
->getWorkflowId();
if ($user
->hasPermission("bypass {$type_id} workflow_transition access")) {
// Superuser is special (might be cron).
// And $force allows Rules to cause transition.
return TRUE;
}
// Determine if user is owner of the entity.
$is_owner = WorkflowManager::isOwner($user, $this
->getTargetEntity());
if ($is_owner) {
$user
->addRole(WORKFLOW_ROLE_AUTHOR_RID);
}
/*
* Get the object and its permissions.
*/
/** @var \Drupal\workflow\Entity\WorkflowTransitionInterface[] $config_transitions */
$config_transitions = $this
->getWorkflow()
->getTransitionsByStateId($this
->getFromSid(), $this
->getToSid());
/*
* Determine if user has Access.
*/
$result = FALSE;
foreach ($config_transitions as $config_transition) {
$result = $result || $config_transition
->isAllowed($user, $force);
}
if ($result == FALSE) {
// @todo There is a watchdog error, but no UI-error. Is this OK?
$message = $this
->t('Attempt to go to nonexistent transition (from %sid1 to %sid2)');
$this
->logError($message);
}
return $result;
}
/**
* Determines if the State changes by this Transition.
*
* @return bool
*/
public function hasStateChange() {
if ($this->from_sid->target_id == $this->to_sid->target_id) {
return FALSE;
}
return TRUE;
}
/**
* {@inheritdoc}
*/
public function execute($force = FALSE) {
// Load the entity, if not already loaded.
// This also sets the (empty) $revision_id in Scheduled Transitions.
/** @var \Drupal\Core\Entity\EntityInterface $entity */
$entity = $this
->getTargetEntity();
// Load explicit User object (not via $transition) for adding Role later.
/** @var \Drupal\user\UserInterface $user */
$user = $this
->getOwner();
$from_sid = $this
->getFromSid();
$to_sid = $this
->getToSid();
$field_name = $this
->getFieldName();
$comment = $this
->getComment();
// Create a label to identify this transition,
// even upon insert, when id() is not set, yet.
$label = $from_sid . '-' . $to_sid;
static $static_info = NULL;
$entity_id = $entity
->id();
// For non-default revisions, there is no way of executing the same transition twice in one call.
// Set a random identifier since we won't be needing to access this variable later.
if ($entity instanceof RevisionableInterface && !$entity
->isDefaultRevision()) {
$entity_id = $entity_id . $entity
->getRevisionId();
}
if (isset($static_info[$entity_id][$field_name][$label]) && !$this
->isEmpty()) {
// Error: this Transition is already executed.
// On the development machine, execute() is called twice, when
// on an Edit Page, the entity has a scheduled transition, and
// user changes it to 'immediately'.
// Why does this happen?? ( BTW. This happens with every submit.)
// Remedies:
// - search root cause of second call.
// - try adapting code of transition->save() to avoid second record.
// - avoid executing twice.
$message = 'Transition is executed twice in a call. The second call for
@entity_type %entity_id is not executed.';
$this
->logError($message);
// Return the result of the last call.
return $static_info[$entity_id][$field_name][$label];
// <-- exit !!!
}
// OK. Prepare for next round. Do not set last_sid!!
$static_info[$entity_id][$field_name][$label] = $from_sid;
// Make sure $force is set in the transition, too.
if ($force) {
$this
->force($force);
}
$force = $this
->isForced();
// Store the transition(s), so it can be easily fetched later on.
// This is a.o. used in:
// - hook_entity_update to trigger 'transition post',
// - hook workflow_access_node_access_records.
$entity->workflow_transitions[$field_name] = $this;
if (!$this
->isValid()) {
return $from_sid;
// <-- exit !!!
}
// @todo Move below code to $this->isAllowed().
// If the state has changed, check the permissions.
// No need to check if Comments or attached fields are filled.
if ($this
->hasStateChange()) {
// Make sure this transition is allowed by workflow module Admin UI.
if (!$force) {
$user
->addRole(WORKFLOW_ROLE_AUTHOR_RID);
}
if (!$this
->isAllowed($user, $force)) {
$message = 'User %user not allowed to go from state %sid1 to %sid2';
$this
->logError($message);
return FALSE;
// <-- exit !!!
}
// Make sure this transition is valid and allowed for the current user.
// Invoke a callback indicating a transition is about to occur.
// Modules may veto the transition by returning FALSE.
// (Even if $force is TRUE, but they shouldn't do that.)
// P.S. The D7 hook_workflow 'transition permitted' is removed, in favour of below hook_workflow 'transition pre'.
$permitted = \Drupal::moduleHandler()
->invokeAll('workflow', [
'transition pre',
$this,
$user,
]);
// Stop if a module says so.
if (in_array(FALSE, $permitted, TRUE)) {
// @todo There is a watchdog error, but no UI-error. Is this OK?
$message = 'Transition vetoed by module.';
$this
->logError($message, 'notice');
return FALSE;
// <-- exit !!!
}
}
/*
* Output: process the transition.
*/
if ($this
->isScheduled()) {
/*
* Log the transition in {workflow_transition_scheduled}.
*/
$this
->save();
}
else {
// The transition is allowed, but not scheduled.
// Let other modules modify the comment.
// The transition (in context) contains all relevant data.
$context = [
'transition' => $this,
];
\Drupal::moduleHandler()
->alter('workflow_comment', $comment, $context);
$this
->setComment($comment);
$this->isExecuted = TRUE;
if (!$this
->isEmpty()) {
/*
* Log the transition in {workflow_transition_history}.
*/
$this
->save();
// Register state change with watchdog.
if ($this
->hasStateChange() && !empty($this
->getWorkflow()
->getSetting('watchdog_log'))) {
if ($this
->getEntityTypeId() == 'workflow_scheduled_transition') {
$message = 'Scheduled state change of @entity_type_label %entity_label to %sid2 executed';
}
else {
$message = 'State of @entity_type_label %entity_label set to %sid2';
}
$this
->logError($message, 'notice');
}
// Notify modules that transition has occurred.
// Action triggers should take place in response to this callback, not the 'transaction pre'.
//
// \Drupal::moduleHandler()->invokeAll('workflow', ['transition post', $this, $user]);
// We have a problem here with Rules, Trigger, etc. when invoking
// 'transition post': the entity has not been saved, yet. we are still
// IN the transition, not AFTER. Alternatives:
// 1. Save the field here explicitly, using field_attach_save;
// 2. Move the invoke to another place: hook_entity_insert(), hook_entity_update();
// 3. Rely on the entity hooks. This works for Rules, not for Trigger.
// --> We choose option 2:
// @todo D8: figure out usage of $entity->workflow_transitions[$field_name].
// - First, $entity->workflow_transitions[] is set for easy re-fetching.
// - Then, post_execute() is invoked via workflow_entity_insert(), _update().
}
}
// Save value in static from top of this function.
$static_info[$entity_id][$field_name][$label] = $to_sid;
return $to_sid;
}
/**
* {@inheritdoc}
*/
public function executeAndUpdateEntity($force = FALSE) {
$to_sid = $this
->getToSid();
// Generate error and stop if transition has no new State.
if (!$to_sid) {
$t_args = [
'%sid2' => $this
->getToState()
->label(),
'%entity_label' => $this
->getTargetEntity()
->label(),
];
$message = "Transition is not executed for %entity_label, since 'To' state %sid2 is invalid.";
$this
->logError($message);
$this
->messenger()
->addError($this
->t($message, $t_args));
return $this
->getFromSid();
}
// Save the (scheduled) transition.
$do_update_entity = !$this
->isScheduled() && !$this
->isExecuted();
if ($do_update_entity) {
$this
->_updateEntity();
}
else {
// We create a new transition, or update an existing one.
// Do not update the entity itself.
// Validate transition, save in history table and delete from schedule table.
$to_sid = $this
->execute($force);
}
return $to_sid;
}
/**
* Internal function to update the Entity.
*/
private function _updateEntity() {
// Update the workflow field of the entity.
$field_name = $this
->getFieldName();
$entity = $this
->getTargetEntity();
// N.B. Align the following functions:
// - WorkflowDefaultWidget::massageFormValues();
// - WorkflowManager::executeTransition().
$entity->{$field_name}->workflow_transition = $this;
$entity->{$field_name}->value = $this
->getToSid();
// Populate the entity changed timestamp when the option is checked.
if ($this
->getWorkflow()
->getSetting('always_update_entity')) {
$entity->changed = $this
->getTimestamp();
}
$entity
->save();
}
/**
* {@inheritdoc}
*/
public function post_execute($force = FALSE) {
// @todo D8: This function post_execute() is not yet used.
workflow_debug(__FILE__, __FUNCTION__, __LINE__);
// @todo D8-port: Test this snippet.
if (!$this
->isEmpty()) {
$user = $this
->getOwner();
\Drupal::moduleHandler()
->invokeAll('workflow', [
'transition post',
$this,
$user,
]);
}
}
/**
* {@inheritdoc}
*/
public function setTargetEntity(EntityInterface $entity) {
if (!$entity) {
$this->entity_type = '';
$this->entity_id = '';
$this->revision_id = '';
$this->delta = 0;
// Only single value is supported.
$this->langcode = Language::LANGCODE_NOT_SPECIFIED;
return $this;
}
// If Transition is added via CommentForm, use the Commented Entity.
if ($entity
->getEntityTypeId() == 'comment') {
/** @var \Drupal\comment\CommentInterface $entity */
$entity = $entity
->getCommentedEntity();
}
$this->entity = $entity;
/** @var \Drupal\Core\Entity\RevisionableContentEntityBase $entity */
$this->entity_type = $entity
->getEntityTypeId();
$this->entity_id = $entity
->id();
$this->revision_id = $entity
->getRevisionId();
$this->delta = 0;
// Only single value is supported.
$this->langcode = $entity
->language()
->getId();
return $this;
}
/**
* {@inheritdoc}
*/
public function getTargetEntity() {
// Use an explicit property, in case of adding new entities.
if (isset($this->entity)) {
return $this->entity;
}
// @todo D8: the following line only returns Node, not Term.
/* return $this->entity = $this->get('entity_id')->entity; */
$entity_type = $this
->getTargetEntityTypeId();
if ($id = $this
->getTargetEntityId()) {
$this->entity = \Drupal::entityTypeManager()
->getStorage($entity_type)
->load($id);
}
return $this->entity;
}
/**
* {@inheritdoc}
*/
public function getTargetEntityId() {
return $this
->get('entity_id')->target_id;
}
/**
* {@inheritdoc}
*/
public function getTargetEntityTypeId() {
return $this
->get('entity_type')->value;
}
/**
* {@inheritdoc}
*/
public function getFieldName() {
return $this
->get('field_name')->value;
}
/**
* {@inheritdoc}
*/
public function getLangcode() {
return $this
->getTargetEntity()
->language()
->getId();
}
/**
* {@inheritdoc}
*/
public function getFromState() {
$sid = $this
->getFromSid();
return $sid ? WorkflowState::load($sid) : NULL;
}
/**
* {@inheritdoc}
*/
public function getToState() {
$sid = $this
->getToSid();
return $sid ? WorkflowState::load($sid) : NULL;
}
/**
* {@inheritdoc}
*/
public function getFromSid() {
$sid = $this->{'from_sid'}->target_id;
return $sid;
}
/**
* {@inheritdoc}
*/
public function getToSid() {
$sid = $this->{'to_sid'}->target_id;
return $sid;
}
/**
* {@inheritdoc}
*/
public function getComment() {
return $this
->get('comment')->value;
}
/**
* {@inheritdoc}
*/
public function setComment($value) {
$this
->set('comment', $value);
return $this;
}
/**
* {@inheritdoc}
*/
public function getTimestamp() {
return $this
->get('timestamp')->value;
}
/**
* {@inheritdoc}
*/
public function getTimestampFormatted() {
$timestamp = $this
->getTimestamp();
return \Drupal::service('date.formatter')
->format($timestamp);
}
/**
* {@inheritdoc}
*/
public function setTimestamp($value) {
$this
->set('timestamp', $value);
return $this;
}
/**
* {@inheritdoc}
*/
public function isScheduled() {
return $this->isScheduled;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function schedule($schedule = TRUE) {
// We do a tricky thing here. The id of the entity is altered, so
// all functions of another subclass are called.
// $this->entityTypeId = ($schedule) ? 'workflow_scheduled_transition' : 'workflow_transition';
//
$this->isScheduled = $schedule;
return $this;
}
/**
* {@inheritdoc}
*/
public function setExecuted($isExecuted = TRUE) {
$this->isExecuted = $isExecuted;
return $this;
}
/**
* {@inheritdoc}
*/
public function isExecuted() {
return (bool) $this->isExecuted;
}
/**
* {@inheritdoc}
*/
public function isForced() {
return (bool) $this->isForced;
}
/**
* {@inheritdoc}
*/
public function force($force = TRUE) {
$this->isForced = $force;
return $this;
}
/**
* Implementing interface EntityOwnerInterface. Copied from Comment.php.
*/
/**
* {@inheritdoc}
*/
public function getOwner() {
/** @var \Drupal\user\UserInterface $user */
$user = $this
->get('uid')->entity;
if (!$user || $user
->isAnonymous()) {
$user = User::getAnonymousUser();
$user
->setUsername(\Drupal::config('user.settings')
->get('anonymous'));
}
return $user;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this
->get('uid')->target_id;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this
->set('uid', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this
->set('uid', $account
->id());
return $this;
}
/**
* Implementing interface FieldableEntityInterface extends EntityInterface.
*/
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = [];
$fields['hid'] = BaseFieldDefinition::create('integer')
->setLabel(t('Transition ID'))
->setDescription(t('The transition ID.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
// $fields['wid'] = BaseFieldDefinition::create('string')
$fields['wid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Workflow Type'))
->setDescription(t('The workflow type the transition relates to.'))
->setSetting('target_type', 'workflow_type')
->setRequired(TRUE)
->setTranslatable(FALSE)
->setRevisionable(FALSE);
$fields['entity_type'] = BaseFieldDefinition::create('string')
->setLabel(t('Entity type'))
->setDescription(t('The Entity type this transition belongs to.'))
->setSetting('is_ascii', TRUE)
->setSetting('max_length', EntityTypeInterface::ID_MAX_LENGTH)
->setReadOnly(TRUE);
$fields['entity_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Entity ID'))
->setDescription(t('The Entity ID this record is for.'))
->setRequired(TRUE)
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['revision_id'] = BaseFieldDefinition::create('integer')
->setLabel(t('Revision ID'))
->setDescription(t('The current version identifier.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['field_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Field name'))
->setDescription(t('The name of the field the transition relates to.'))
->setRequired(TRUE)
->setTranslatable(FALSE)
->setRevisionable(FALSE)
->setSetting('max_length', 32);
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language'))
->setDescription(t('The entity language code.'))
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'region' => 'hidden',
])
->setDisplayOptions('form', [
'type' => 'language_select',
'weight' => 2,
]);
$fields['delta'] = BaseFieldDefinition::create('integer')
->setLabel(t('Delta'))
->setDescription(t('The sequence number for this data item, used for multi-value fields.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['from_sid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('From state'))
->setDescription(t('The {workflow_states}.sid the entity started as.'))
->setSetting('target_type', 'workflow_state')
->setReadOnly(TRUE);
$fields['to_sid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('To state'))
->setDescription(t('The {workflow_states}.sid the entity transitioned to.'))
->setSetting('target_type', 'workflow_state')
->setReadOnly(TRUE);
$fields['uid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('User ID'))
->setDescription(t('The user ID of the transition author.'))
->setTranslatable(TRUE)
->setSetting('target_type', 'user')
->setDefaultValue(0)
->setRevisionable(TRUE);
$fields['timestamp'] = BaseFieldDefinition::create('created')
->setLabel(t('Timestamp'))
->setDescription(t('The time that the current transition was executed.'))
->setRevisionable(TRUE);
$fields['comment'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Log message'))
->setDescription(t('The comment explaining this transition.'))
->setRevisionable(TRUE)
->setTranslatable(TRUE);
return $fields;
}
/**
* Generate a Watchdog error.
*
* @param $message
* @param $type
* {'error' | 'notice'}
* @param $from_sid
* @param $to_sid
*/
public function logError($message, $type = 'error', $from_sid = '', $to_sid = '') {
// Prepare an array of arguments for error messages.
$entity = $this
->getTargetEntity();
$t_args = [
/** @var \Drupal\user\UserInterface $user */
'%user' => ($user = $this
->getOwner()) ? $user
->getDisplayName() : '',
'%sid1' => $from_sid || !$this
->getFromState() ? $from_sid : $this
->getFromState()
->label(),
'%sid2' => $to_sid || !$this
->getToState() ? $to_sid : $this
->getToState()
->label(),
'%entity_id' => $this
->getTargetEntityId(),
'%entity_label' => $entity ? $entity
->label() : '',
'@entity_type' => $entity ? $entity
->getEntityTypeId() : '',
'@entity_type_label' => $entity ? $entity
->getEntityType()
->getLabel() : '',
'link' => $this
->getTargetEntityId() && $this
->getTargetEntity()
->hasLinkTemplate('canonical') ? $this
->getTargetEntity()
->toLink($this
->t('View'))
->toString() : '',
];
$type == 'error' ? \Drupal::logger('workflow')
->error($message, $t_args) : \Drupal::logger('workflow')
->notice($message, $t_args);
}
/**
* {@inheritdoc}
*/
public function dpm($function = '') {
$transition = $this;
$entity = $transition
->getTargetEntity();
$time = \Drupal::service('date.formatter')
->format($transition
->getTimestamp());
// Do this extensive $user_name lines, for some troubles with Action.
$user = $transition
->getOwner();
$user_name = $user ? $user
->getAccountName() : 'unknown username';
$t_string = $this
->getEntityTypeId() . ' ' . $this
->id() . ' for workflow_type <i>' . $this
->getWorkflowId() . '</i> ' . ($function ? "in function '{$function}'" : '');
$output[] = 'Entity = ' . $this
->getTargetEntityTypeId() . '/' . ($entity ? $entity
->bundle() . '/' . $entity
->id() : '___/0');
$output[] = 'Field = ' . $transition
->getFieldName();
$output[] = 'From/To = ' . $transition
->getFromSid() . ' > ' . $transition
->getToSid() . ' @ ' . $time;
$output[] = 'Comment = ' . $user_name . ' says: ' . $transition
->getComment();
$output[] = 'Forced = ' . ($transition
->isForced() ? 'yes' : 'no') . '; ' . 'Scheduled = ' . ($transition
->isScheduled() ? 'yes' : 'no');
if (function_exists('dpm')) {
// In Workflow->dpm().
dpm($output, $t_string);
// In Workflow->dpm().
}
// In Workflow->dpm().
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
ContentEntityBase:: |
protected | property | Language code identifying the entity active language. | |
ContentEntityBase:: |
protected | property | Local cache for the default language code. | |
ContentEntityBase:: |
protected | property | The default langcode entity key. | |
ContentEntityBase:: |
protected | property | Whether the revision translation affected flag has been enforced. | |
ContentEntityBase:: |
protected | property | Holds untranslatable entity keys such as the ID, bundle, and revision ID. | |
ContentEntityBase:: |
protected | property | Local cache for field definitions. | |
ContentEntityBase:: |
protected | property | The array of fields, each being an instance of FieldItemListInterface. | |
ContentEntityBase:: |
protected static | property | Local cache for fields to skip from the checking for translation changes. | |
ContentEntityBase:: |
protected | property | Indicates whether this is the default revision. | |
ContentEntityBase:: |
protected | property | The language entity key. | |
ContentEntityBase:: |
protected | property | Local cache for the available language objects. | |
ContentEntityBase:: |
protected | property | The loaded revision ID before the new revision was set. | |
ContentEntityBase:: |
protected | property | Boolean indicating whether a new revision should be created on save. | |
ContentEntityBase:: |
protected | property | The revision translation affected entity key. | |
ContentEntityBase:: |
protected | property | Holds translatable entity keys such as the label. | |
ContentEntityBase:: |
protected | property | A flag indicating whether a translation object is being initialized. | |
ContentEntityBase:: |
protected | property | An array of entity translation metadata. | |
ContentEntityBase:: |
protected | property | Whether entity validation was performed. | |
ContentEntityBase:: |
protected | property | Whether entity validation is required before saving the entity. | |
ContentEntityBase:: |
protected | property | The plain data values of the contained fields. | |
ContentEntityBase:: |
public | function |
Checks data value access. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Adds a new translation to the translatable object. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the bundle of the entity. Overrides EntityBase:: |
|
ContentEntityBase:: |
public static | function |
Provides field definitions for a specific bundle. Overrides FieldableEntityInterface:: |
4 |
ContentEntityBase:: |
protected | function | Clear entity translation object cache to remove stale references. | |
ContentEntityBase:: |
public | function |
Creates a duplicate of the entity. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Gets a field item list. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Gets the value of the given entity key, if defined. | 1 |
ContentEntityBase:: |
public | function |
Gets the definition of a contained field. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of field definitions of all contained fields. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of all field item lists. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Returns an array of field names to skip in ::hasTranslationChanges. | 1 |
ContentEntityBase:: |
public | function | ||
ContentEntityBase:: |
protected | function | ||
ContentEntityBase:: |
public | function |
Gets the loaded Revision ID of the entity. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the revision identifier of the entity. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of field item lists for translatable fields. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Gets a translated field. | |
ContentEntityBase:: |
public | function |
Gets a translation of the data. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the languages the data is translated to. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translation status. Overrides TranslationStatusInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translatable object referring to the original language. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines whether the entity has a field with the given name. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Checks there is a translation for the given language code. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines if the current translation of the entity has unsaved changes. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the identifier. Overrides EntityBase:: |
|
ContentEntityBase:: |
protected | function | Instantiates a translation object for an existing translation. | |
ContentEntityBase:: |
public | function |
Checks if this entity is the default revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the translation is the default one. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if untranslatable fields should affect only the default translation. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if this entity is the latest revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether this is the latest revision affecting this translation. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines whether a new revision should be created on save. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the translation is new. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the current translation is affected by the current revision. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if the revision translation affected flag value has been enforced. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translation support status. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the label of the entity. Overrides EntityBase:: |
2 |
ContentEntityBase:: |
public | function |
Gets the language of the entity. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Reacts to changes to a field. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Acts on a created entity before hooks are invoked. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Acts on a saved entity before the insert or update hook is invoked. Overrides EntityBase:: |
5 |
ContentEntityBase:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides EntityBase:: |
5 |
ContentEntityBase:: |
public | function |
Acts on a revision before it gets saved. Overrides RevisionableInterface:: |
2 |
ContentEntityBase:: |
public | function |
Gets a list of entities referenced by this entity. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Removes the translation identified by the given language code. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Sets a field value. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Populates the local cache for the default language code. | |
ContentEntityBase:: |
public | function |
Enforces an entity to be saved as a new revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Marks the current revision translation as affected. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Enforces the revision translation affected flag value. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Sets whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of all property values. Overrides EntityBase:: |
|
ContentEntityBase:: |
protected | function | Updates language for already instantiated fields. | |
ContentEntityBase:: |
public | function |
Updates the loaded Revision ID with the revision ID. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function | Updates the original values with the interim changes. | |
ContentEntityBase:: |
public | function |
Gets the entity UUID (Universally Unique Identifier). Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Validates the currently set values. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the entity object was a default revision when it was saved. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function | Magic method: Implements a deep clone. | |
ContentEntityBase:: |
public | function | Implements the magic method for getting object properties. | |
ContentEntityBase:: |
public | function | Implements the magic method for isset(). | |
ContentEntityBase:: |
public | function | Implements the magic method for setting object properties. | |
ContentEntityBase:: |
public | function |
Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function | Implements the magic method for unset(). | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | Aliased as: traitSleep | 1 |
DependencySerializationTrait:: |
public | function | 2 | |
EntityBase:: |
protected | property | Boolean indicating whether the entity should be forced to be new. | |
EntityBase:: |
protected | property | The entity type. | |
EntityBase:: |
protected | property | A typed data object wrapping this entity. | |
EntityBase:: |
public | function |
Deletes an entity permanently. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Enforces an entity to be new. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets the entity manager. | |
EntityBase:: |
protected | function | Gets the entity type bundle info service. | |
EntityBase:: |
protected | function | Gets the entity type manager. | |
EntityBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the configuration dependency name. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the configuration target identifier for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the entity type definition. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the ID of the type of the entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | The list cache tags to invalidate for this entity. | |
EntityBase:: |
public | function |
Gets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets a typed data object for this entity object. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Indicates if a link template exists for a given key. Overrides EntityInterface:: |
|
EntityBase:: |
protected static | function | Invalidates an entity's cache tags upon delete. | 1 |
EntityBase:: |
protected | function | Invalidates an entity's cache tags upon save. | 1 |
EntityBase:: |
public | function |
Determines whether the entity is new. Overrides EntityInterface:: |
2 |
EntityBase:: |
protected | function | Gets the language manager. | |
EntityBase:: |
public | function |
Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array link templates. | 1 |
EntityBase:: |
public static | function |
Loads an entity. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Loads one or more entities. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface:: |
16 |
EntityBase:: |
public static | function |
Acts on loaded entities. Overrides EntityInterface:: |
2 |
EntityBase:: |
public static | function |
Changes the values of an entity before it is created. Overrides EntityInterface:: |
5 |
EntityBase:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public | function |
Sets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Generates the HTML for a link to this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets a list of URI relationships supported by this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the public URL for this entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array of placeholders for this entity. | 2 |
EntityBase:: |
protected | function | Gets the UUID generator. | |
EntityChangesDetectionTrait:: |
protected | function | Returns an array of field names to skip when checking for changes. Aliased as: traitGetFieldsToSkipFromTranslationChangesCheck | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
SynchronizableEntityTrait:: |
protected | property | Whether this entity is being created, updated or deleted through a synchronization process. | |
SynchronizableEntityTrait:: |
public | function | ||
SynchronizableEntityTrait:: |
public | function | ||
TranslationStatusInterface:: |
constant | Status code identifying a newly created translation. | ||
TranslationStatusInterface:: |
constant | Status code identifying an existing translation. | ||
TranslationStatusInterface:: |
constant | Status code identifying a removed translation. | ||
WorkflowTransition:: |
protected | property | @usage Use WorkflowTransition->getTargetEntity() to fetch this. | |
WorkflowTransition:: |
protected | property | Extra data: describe the state of the transition. | |
WorkflowTransition:: |
protected | property | Extra data: describe the state of the transition. | |
WorkflowTransition:: |
protected | property | Extra data: describe the state of the transition. | |
WorkflowTransition:: |
protected | property | @usage Use WorkflowTransition->getOwner() to fetch this. | |
WorkflowTransition:: |
public static | function |
Provides base field definitions for an entity type. Overrides ContentEntityBase:: |
1 |
WorkflowTransition:: |
public static | function |
Overrides EntityBase:: |
|
WorkflowTransition:: |
public | function |
Helper/debugging function. Shows simple contents of Transition. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Execute a transition (change state of an entity). Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Executes a transition (change state of an entity), from OUTSIDE the entity. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Set if a transition must be executed, even if transition is invalid or user not authorized. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Get the comment of the Transition. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Get the field_name for which the Transition is valid. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Overrides WorkflowConfigTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Overrides WorkflowConfigTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Get the language code for which the Transition is valid. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the entity owner's user entity. Overrides EntityOwnerInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the entity owner's user ID. Overrides EntityOwnerInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the entity to which the workflow is attached. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the ID of the entity to which the workflow is attached. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the type of the entity to which the workflow is attached. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the time on which the transitions was or will be executed. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the human-readable time. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Overrides WorkflowConfigTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Overrides WorkflowConfigTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Determines if the State changes by this Transition. Overrides WorkflowConfigTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Determines if the current transition between 2 states is allowed. Overrides WorkflowConfigTransitionInterface:: |
|
WorkflowTransition:: |
protected | function | Check if anything has changed in this transition. | |
WorkflowTransition:: |
public | function |
Returns if this is an Executed Transition. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
A transition may be forced skipping checks. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns if this is a revertable Transition on the History tab. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns if this is a Scheduled Transition. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function | Determines if the Transition is valid and can be executed. | |
WorkflowTransition:: |
public static | function |
Load (Scheduled) WorkflowTransitions, most recent first. Overrides WorkflowTransitionInterface:: |
1 |
WorkflowTransition:: |
public static | function |
Given an entity, get all transitions for it. Overrides WorkflowTransitionInterface:: |
1 |
WorkflowTransition:: |
public | function | Generate a Watchdog error. | |
WorkflowTransition:: |
public | function |
Invokes 'transition post'. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Saves the entity. Overrides EntityBase:: |
1 |
WorkflowTransition:: |
public | function |
Sets the Transition to be scheduled or not. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Get the comment of the Transition. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Set the 'isExecuted' property. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Sets the entity owner's user entity. Overrides EntityOwnerInterface:: |
|
WorkflowTransition:: |
public | function |
Sets the entity owner's user ID. Overrides EntityOwnerInterface:: |
|
WorkflowTransition:: |
public | function |
Sets the Entity, that is added to the Transition. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Returns the time on which the transitions was or will be executed. Overrides WorkflowTransitionInterface:: |
|
WorkflowTransition:: |
public | function |
Helper function for __construct. Used for all children of WorkflowTransition (aka WorkflowScheduledTransition) Overrides WorkflowTransitionInterface:: |
1 |
WorkflowTransition:: |
private | function | Internal function to update the Entity. | |
WorkflowTransition:: |
public | function |
Creates a new entity. Overrides ContentEntityBase:: |
1 |
WorkflowTypeAttributeTrait:: |
protected | property | The machine_name of the attached Workflow. | |
WorkflowTypeAttributeTrait:: |
protected | property | The attached Workflow. | |
WorkflowTypeAttributeTrait:: |
public | function | Returns the Workflow object of this object. | |
WorkflowTypeAttributeTrait:: |
public | function | Returns the Workflow ID of this object. | |
WorkflowTypeAttributeTrait:: |
public | function | ||
WorkflowTypeAttributeTrait:: |
public | function | Sets the Workflow ID of this object. |