Skip to content
Snippets Groups Projects

Update link templates of test entities

Closed quietone requested to merge issue/drupal-2699959:2699959-update-link-templates into 11.x
Files
13
@@ -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.
Loading