Commit 1c404159 authored by Will Eaton's avatar Will Eaton Committed by John Voskuilen
Browse files

Issue #2724107 by willeaton: State is not saved for Entity Field with 'Hidden' widget

parent 95a72f65
Loading
Loading
Loading
Loading
+1 −3
Changes for src/Entity/WorkflowManager.php: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -163,12 +163,10 @@ class WorkflowManager implements WorkflowManagerInterface {
        }

        // Creating a Node with hidden Workflow Widget. Generate valid first transition.
        // @todo D8: Test Creating a non-Node Entity with hidden Workflow widget.
        $comment = '';
        $old_sid = WorkflowManager::getPreviousStateId($entity, $field_name);
        $new_sid = $entity->{$field_name}->value;
        $field_info = FieldStorageConfig::loadByName($entity->getEntityTypeId(), $field_name);
        if ((!$new_sid) && $wid = $field_info->getSetting('workflow_type')) {
        if ((!$new_sid) && $wid = $entity->{$field_name}->getSetting('workflow_type')) {
          /** @var \Drupal\workflow\Entity\Workflow $workflow */
          $workflow = Workflow::load($wid);
          $new_sid = $workflow->getFirstSid($entity, $field_name, $user);