diff --git a/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php b/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php index c3eccbe7b1b45b636a3fb4203ab1250e81a9c87b..dc460ed70f264922cbd0d21ae144655088da65be 100644 --- a/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php +++ b/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php @@ -154,11 +154,7 @@ protected function getAddFormRoute(EntityTypeInterface $entity_type) { // If the entity has bundles, we can provide a bundle-specific title // and access requirements. - $expected_parameter = $entity_type->getBundleEntityType() ?: $entity_type->getKey('bundle'); - // @todo We have to check if a route contains a bundle in its path as - // test entities have inconsistent usage of "add-form" link templates. - // Fix it in https://www.drupal.org/node/2699959. - if (($bundle_key = $entity_type->getKey('bundle')) && str_contains($route->getPath(), '{' . $expected_parameter . '}')) { + if ($bundle_key = $entity_type->getKey('bundle')) { $route->setDefault('_title_callback', EntityController::class . '::addBundleTitle'); // If the bundles are entities themselves, we can add parameter // information to the route options. diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php index 2afedb543ef3cc45aec7c58a8be61b83b03e39c6..9c7298121a0c446b3d720909e616aa88fa1ed900 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php @@ -47,7 +47,8 @@ ], links: [ 'canonical' => '/entity_test/{entity_test}', - 'add-form' => '/entity_test/add', + 'add-form' => '/entity_test/add/{type}', + 'add-page' => '/entity_test/add', 'edit-form' => '/entity_test/manage/{entity_test}/edit', 'delete-form' => '/entity_test/delete/entity_test/{entity_test}', ], diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestAddPage.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestAddPage.php index da2226e32e778fcc52a6033dfa0544614e5e71ac..b73e198ef93ff09b3ed2a05bfebc434a184687db 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestAddPage.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestAddPage.php @@ -32,7 +32,7 @@ ], links: [ 'add-page' => '/entity_test_add_page/{user}/add', - 'add-form' => '/entity_test_add_page/add/{user}/form', + 'add-form' => '/entity_test_add_page/add/{type}/{user}/form', ], admin_permission: 'administer entity_test content', base_table: 'entity_test_add_page', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php index bfb0f6b10adeae21b9168807804b762b1274ee94..6ffeadde9073ef5880e0ab1e05847c3837b192bd 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php @@ -43,7 +43,8 @@ 'views_data' => EntityViewsData::class, ], links: [ - 'add-form' => '/entity_test_mul_changed/add', + 'add-form' => '/entity_test_mul_changed/add/{type}', + 'add-page' => '/entity_test_mul_changed/add', 'canonical' => '/entity_test_mul_changed/manage/{entity_test_mul_changed}', 'edit-form' => '/entity_test_mul_changed/manage/{entity_test_mul_changed}/edit', 'delete-form' => '/entity_test/delete/entity_test_mul_changed/{entity_test_mul_changed}', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php index a536f72bcd4f8f1acf9d5cf53f22a0549bb11a10..5c7ab4e80b99c1ed94afe3bf0402fd073ac34022 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php @@ -40,7 +40,8 @@ ], ], links: [ - 'add-form' => '/entity_test_mul_langcode_key/add', + 'add-form' => '/entity_test_mul_langcode_key/add/{type}', + 'add-page' => '/entity_test_mul_langcode_key/add', 'canonical' => '/entity_test_mul_langcode_key/manage/{entity_test_mul_langcode_key}', 'edit-form' => '/entity_test_mul_langcode_key/manage/{entity_test_mul_langcode_key}/edit', 'delete-form' => '/entity_test/delete/entity_test_mul_langcode_key/{entity_test_mul_langcode_key}', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php index 58e0072e0fd7ef500dd8aac90b07644df5282bfc..ab28719c20a349ab24fd3eb665a7f59e24b97800 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php @@ -40,7 +40,8 @@ 'route_provider' => ['html' => DefaultHtmlRouteProvider::class], ], links: [ - 'add-form' => '/entity_test_mulrev/add', + 'add-form' => '/entity_test_mulrev/add/{type}', + 'add-page' => '/entity_test_mulrev/add', 'canonical' => '/entity_test_mulrev/manage/{entity_test_mulrev}', 'delete-form' => '/entity_test/delete/entity_test_mulrev/{entity_test_mulrev}', 'edit-form' => '/entity_test_mulrev/manage/{entity_test_mulrev}/edit', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevChanged.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevChanged.php index e88e6714e637f16b5816581068ba7c8c130a2329..6824b1d84064582c572d2b3377fa1ba04f76900b 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevChanged.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevChanged.php @@ -42,7 +42,8 @@ 'views_data' => EntityViewsData::class, ], links: [ - 'add-form' => '/entity_test_mulrev_changed/add', + 'add-form' => '/entity_test_mulrev_changed/add/{type}', + 'add-page' => '/entity_test_mulrev_changed/add', 'canonical' => '/entity_test_mulrev_changed/manage/{entity_test_mulrev_changed}', 'delete-form' => '/entity_test/delete/entity_test_mulrev_changed/{entity_test_mulrev_changed}', 'edit-form' => '/entity_test_mulrev_changed/manage/{entity_test_mulrev_changed}/edit', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevPub.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevPub.php index 412c60e9ae9164ecfb8d668fc3ebdc5549e72f23..20faeb58d4f3e041df72f3bb52836bad9cc5d271 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevPub.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRevPub.php @@ -46,7 +46,8 @@ ], ], links: [ - 'add-form' => '/entity_test_mulrevpub/add', + 'add-form' => '/entity_test_mulrevpub/add/{type}', + 'add-page' => '/entity_test_mulrevpub/add', 'canonical' => '/entity_test_mulrevpub/manage/{entity_test_mulrevpub}', 'delete-form' => '/entity_test/delete/entity_test_mulrevpub/{entity_test_mulrevpub}', 'delete-multiple-form' => '/entity_test/delete', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php index 7382b31a553522fbee41b4d51de4479dd2fe47f2..eb6a5649fe9eda6ab67d796b5129a6f6c8081c69 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php @@ -21,7 +21,8 @@ 'storage' => ContentEntityNullStorage::class, ], links: [ - 'add-form' => '/entity_test_no_id/add', + 'add-form' => '/entity_test_no_id/add/{type}', + 'add-page' => '/entity_test_no_id/add', ], admin_permission: 'administer entity_test content', field_ui_base_route: 'entity.entity_test_no_id.admin_form', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php index 1aa90d50d301fe8c1dd4261b18a40c455875955e..7f4f25572e91b05d7acf6cf3305c149e66bbe37f 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php @@ -50,7 +50,8 @@ ], ], links: [ - 'add-form' => '/entity_test_rev/add', + 'add-form' => '/entity_test_rev/add/{type}', + 'add-page' => '/entity_test_rev/add', 'canonical' => '/entity_test_rev/manage/{entity_test_rev}', 'delete-form' => '/entity_test/delete/entity_test_rev/{entity_test_rev}', 'delete-multiple-form' => '/entity_test_rev/delete_multiple', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRevPub.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRevPub.php index 877710005c05821e7f8fd9765484375a88eb8427..6b8d97f96ffc736915894513d4c054cc2f2bc2b7 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRevPub.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRevPub.php @@ -51,6 +51,7 @@ ], links: [ 'add-form' => '/entity_test_revpub/add', + 'add-page' => '/entity_test_revpub/add/{type}', 'canonical' => '/entity_test_revpub/manage/{entity_test_revpub}', 'delete-form' => '/entity_test/delete/entity_test_revpub/{entity_test_revpub}', 'delete-multiple-form' => '/entity_test_revpub/delete_multiple', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php index 2db1fe8bc0197d4462f48bbd253e89ca330d2205..9dd9d010ef7c90c8af7e74c0366038b3568a3df7 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php @@ -35,7 +35,8 @@ ], links: [ 'canonical' => '/entity_test_string_id/manage/{entity_test_string_id}', - 'add-form' => '/entity_test_string_id/add', + 'add-form' => '/entity_test_string_id/add/{type}', + 'add-page' => '/entity_test_string_id/add', 'edit-form' => '/entity_test_string_id/manage/{entity_test_string_id}', ], admin_permission: 'administer entity_test content', diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUuidId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUuidId.php index 5935fd857dedd4a919e5b4cbfeca31cbd134ab67..2385612cd465eb6d8b65acc649c5aa2f4c771583 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUuidId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUuidId.php @@ -37,7 +37,8 @@ * }, * links = { * "canonical" = "/entity_test_uuid_id/manage/{entity_test_uuid_id}", - * "add-form" = "/entity_test_uuid_id/add", + * "add-form" = "/entity_test_uuid_id/add/{type}", + * "add-page" = "/entity_test_uuid_id/add", * "edit-form" = "/entity_test_uuid_id/manage/{entity_test_uuid_id}/edit", * }, * )