diff --git a/src/Entity/WorkflowTransition.php b/src/Entity/WorkflowTransition.php index 256d7d54fabd14231a6d751a43e46368e9cc7a3d..2f7ff705c12fb83a524c0ca5a926afc455c0fd84 100644 --- a/src/Entity/WorkflowTransition.php +++ b/src/Entity/WorkflowTransition.php @@ -665,26 +665,28 @@ class WorkflowTransition extends ContentEntityBase implements WorkflowTransition } /** - * {@inheritdoc} + * Update the workflow field of the entity in two formats. */ public function updateEntity() { - // Update the workflow field of the entity in two formats. $entity = $this->getTargetEntity(); $field_name = $this->getFieldName(); $to_sid = $this->getToSid(); // N.B. Align the following functions: // - WorkflowDefaultWidget::massageFormValues(); // - WorkflowManager::executeTransition(). - $items = $entity->{$field_name}; - // $items->filterEmptyItems(); - // $items->value = $to_sid; - // $entity->{$field_name}->value = $to_sid; $items->setValue($to_sid); $items->__set('_workflow_transition', $this); - // Populate the entity changed timestamp when the option is checked. + $this->updateEntityChangedTime(); + } + + /** + * Update the Entity's ChangedTime when the option is set. + */ + public function updateEntityChangedTime() { if ($this->getWorkflow()->getSetting('always_update_entity')) { + $entity = $this->getTargetEntity(); // Copied from EntiyFormDisplay::updateChangedTime(EntityInterface $entity) { if ($entity instanceof EntityChangedInterface) { // $entity->setChangedTime($this->time->getRequestTime());