- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
-
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -65,11 +82,17 @@ public static function createInstance(ContainerInterface $container, EntityTypeI + $this->linkGenerator = $link_generator;
Is the disruption of injecting the link generator worth it?
All the other links we generate in this class (e.g. in operations) don't need/use it so that makes me feel we may not need it.
That would dramatically reduce the complexity of this patch and the disruption to contrib.
-
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -248,4 +269,61 @@ protected function ensureDestination(Url $url) { + Url::fromUri('internal:' . $this->entityType->getLinkTemplate('add-page')) ... + Url::fromUri('internal:' . $this->entityType->getLinkTemplate('add-form'))
Is internal: our only option here?
\Drupal\Core\Entity\Controller\EntityController::addPage
usesLink::createFromRoute
-
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -248,4 +269,61 @@ protected function ensureDestination(Url $url) { + elseif ($this->entityType->hasLinkTemplate('add-form')) {
This could return an exception if there is no add page link template, but there is an add-form link template but it requires additional parameters. So we probably would need a try/catch here.
Also, we don't need elseif, there's a return above.
- Coming from 🐛 Remove duplicate "add block" link from block content type view's "Results not found" message Postponed I was expecting to see something here for admin lists that are built with views, as in reality most content-entity list builders are overridden with a view. It would be good to get an issue summary update here to address what the intended course of action is there.
-