--- fall-back-to-default-2511720-16.patch 2019-09-17 16:35:39.434262703 +0300 +++ 2511720-21.patch 2019-09-17 17:27:44.669565977 +0300 @@ -1,5 +1,5 @@ diff --git a/core/lib/Drupal/Core/Entity/EntityTypeManager.php b/core/lib/Drupal/Core/Entity/EntityTypeManager.php -index 5544e4a43d..5c5668d3cd 100644 +index 5544e4a..f1aad2f 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeManager.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeManager.php @@ -220,7 +220,12 @@ public function getListBuilder($entity_type_id) { @@ -7,12 +7,33 @@ public function getFormObject($entity_type_id, $operation) { if (!$class = $this->getDefinition($entity_type_id, TRUE)->getFormClass($operation)) { - throw new InvalidPluginDefinitionException($entity_type_id, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type_id, $operation)); -+ // If there is not a class specified for this operation, try the default -+ // class. This condition is likely used by form modes added through -+ // the form modes user interface. -+ if (!$class = $this->getDefinition($entity_type_id, TRUE)->getFormClass('default')) { -+ throw new InvalidPluginDefinitionException($entity_type_id, sprintf('The "%s" entity type did not specify a "%s" form class and there is not a default class.', $entity_type_id, $operation)); -+ } ++ // If there is not a class specified for this operation, try the default ++ // class. This condition is likely used by form modes added through ++ // the form modes user interface. ++ if (!$class = $this->getDefinition($entity_type_id, TRUE)->getFormClass('default')) { ++ throw new InvalidPluginDefinitionException($entity_type_id, sprintf('The "%s" entity type did not specify a "%s" form class and there is not a default class.', $entity_type_id, $operation)); ++ } } $form_object = $this->classResolver->getInstanceFromDefinition($class); +diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php +index 70cac60..0e2cc96 100644 +--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php ++++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php +@@ -268,7 +268,9 @@ public function testGetFormObjectInvalidOperation() { + $entity->getFormClass('edit')->willReturn(''); + $this->setUpEntityTypeDefinitions(['test_entity_type' => $entity]); + +- $this->setExpectedException(InvalidPluginDefinitionException::class); ++ $entity->getFormClass('default')->willReturn(''); ++ $this->setExpectedException(InvalidPluginDefinitionException::class, ++ 'The "test_entity_type" entity type did not specify a "edit" form class and there is not a default class'); + $this->entityTypeManager->getFormObject('test_entity_type', 'edit'); + } +