diff --git a/core/modules/workflows/src/Form/WorkflowStateAddForm.php b/core/modules/workflows/src/Form/WorkflowStateAddForm.php index b15c75720f..3011fef97b 100644 --- a/core/modules/workflows/src/Form/WorkflowStateAddForm.php +++ b/core/modules/workflows/src/Form/WorkflowStateAddForm.php @@ -87,14 +87,12 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, $values = $form_state->getValues(); try { - // Replicate the validation that Workflow::addState() does internally as the - // form values have not been validated at this point. if (!$entity->hasState($values['id'])) { $entity->addState($values['id'], $values['label']); if (isset($values['type_settings'])) { $configuration = $entity->getTypePlugin()->getConfiguration(); - $configuration['states'][$values['id']] = $values['type_settings'][$entity->getTypePlugin() - ->getPluginId()]; + // @todo move to submitStateConfigurationForm. #2849827. + $configuration['states'][$values['id']] += $values['type_settings'][$entity->getTypePlugin()->getPluginId()]; $entity->set('type_settings', $configuration); } } diff --git a/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php b/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php index bc9d3908c8..9b569ba33f 100644 --- a/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php +++ b/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php @@ -113,8 +113,7 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, $entity->addTransition($values['id'], $values['label'], array_filter($values['from']), $values['to']); if (isset($values['type_settings'])) { $configuration = $entity->getTypePlugin()->getConfiguration(); - $configuration['transitions'][$values['id']] = $values['type_settings'][$entity->getTypePlugin() - ->getPluginId()]; + $configuration['transitions'][$values['id']] += $values['type_settings'][$entity->getTypePlugin()->getPluginId()]; $entity->set('type_settings', $configuration); } } diff --git a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php index 1c0724ade3..8fdadeedfa 100644 --- a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php +++ b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php @@ -164,7 +164,7 @@ public function addState($state_id, $label) { throw new \InvalidArgumentException("The state '$state_id' already exists in workflow."); } if (preg_match(static::VALID_ID_REGEX, $state_id)) { - throw new \InvalidArgumentException("The state ID '$state_id' must contain only lowercase letters, numbers, and underscores"); + throw new \InvalidArgumentException("The state ID '$state_id' must contain only lowercase letters, numbers, and underscores, but not solely numbers."); } $this->configuration['states'][$state_id] = [ 'label' => $label, @@ -267,7 +267,7 @@ public function addTransition($transition_id, $label, array $from_state_ids, $to throw new \InvalidArgumentException("The transition '$transition_id' already exists in workflow.'"); } if (preg_match(static::VALID_ID_REGEX, $transition_id)) { - throw new \InvalidArgumentException("The transition ID '$transition_id' must contain only lowercase letters, numbers, and underscores."); + throw new \InvalidArgumentException("The transition ID '$transition_id' must contain only lowercase letters, numbers, and underscores, but not solely numbers."); } if (!$this->hasState($to_state_id)) {