Problem/Motivation

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.display_builder_instance.collection" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 242 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Proposed resolution

--- a/src/Plugin/display_builder/Island/InstancesPanel.php
+++ b/src/Plugin/display_builder/Island/InstancesPanel.php
@@ -42,6 +42,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
   type: IslandType::View,
   region: 'sidebar',
   icon: 'files',
+  modules: ['display_builder_ui'],
 )]
 class InstancesPanel extends IslandPluginBase {
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Active » Needs review
mogtofu33’s picture

Status: Needs review » Needs work
Issue tags: -display_builder-1.0.0-beta +RC blocker, +display_builder-1.0.0-beta8

Thanks for the issue and the solution.

I do not think it is a good idea to remove the whole Island when display_builder_ui is disabled just for some partial links.
The switch feature is still valid and useful (every other builder offer this switch), I will push an approach where Island is still available.

mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Needs work » Needs review

Here is my proposition, tackle only the root of the problem so the island can still be used.

pdureau’s picture

Assigned: pdureau » mogtofu33
Issue summary: View changes
Status: Needs review » Needs work

I do not think it is a good idea to remove the whole Island when display_builder_ui is disabled just for some partial links.

I agree :)

I have tested the MR and I was ready to RTBC:

✅ with display_builder_ui:

<div class="db-instances__group">
  <div class="db-instances__title"><h4>
     <sl-button class="db-instances__title-link shoelace-button" title="All Entity view" href="/admin/structure/display-builder/instances?context=entity_view" data-component-id="display_builder:button" variant="text" size="medium" data-optional="" data-valid="">
      Entity view
    </sl-button>
  </h4></div>
...
</div>

✅ without display_builder_ui:

<div class="db-instances__group">
  <div class="db-instances__title"><h4>Entity view</h4></div>
  ...
</div>

But I don't understand this part of the MR:

  /**
   * Fallback for URLs composed from an instance ID that no longer resolves.
   *
   * A fallback must not throw where the URL it replaces would not have, so
   * without display_builder_ui it lands on the front page.
   *
   * @return \Drupal\Core\Url
   *   The instance list, or the front page.
   */
  protected static function instanceCollectionUrl(): Url {
    return self::instanceListUrl() ?? Url::fromRoute('<front>');
  }

Why the front page as a fallback if we don't print the link anymore? Where exactly do we print this link to front page when display_builder_ui is not activated?. Landing to the front page may confuse the user.

mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Needs work » Needs review

Good catch, thanks. The fallback was wrong, it is gone.

The front page link was printed in one place only: the Instances panel, "Views" group, when both display_builder_ui and views_ui are off. A view display not built with Display Builder linked to the Views UI edit form, fell back to the instance list, then to the front page.

Now:

  • ViewDisplay::viewEditUrl() returns NULL without views_ui. A display with nothing to link to is not listed, same as entity view displays without field_ui. A built display keeps its builder link, with no settings link.
  • instanceCollectionUrl() is removed. The "unknown instance ID" fallbacks are back to the instance list as before. Without display_builder_ui they are not reachable: you cannot open a builder whose target no longer exists.

Covered by CollectDisplaysTest::testWithoutViewsUi().

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs review » Needs work
StatusFileSize
new31.47 KB

It works well.

I have just a nitpick (the last one, I guess).

When we mix .db-instances__title with and without links, they are shifted left and right:
aa

It may be because of the shoelace button we are using inside the title.

Naive proposal:

+++ b/src/Plugin/display_builder/Island/InstancesPanel.php
@@ -928,18 +928,14 @@ class InstancesPanel extends IslandPluginBase {
    */
   protected function buildGroupHeadingLink(string|TranslatableMarkup $label, Url $url): array {
     $build = [
-      '#type' => 'component',
-      '#component' => 'display_builder:button',
-      '#props' => [
-        'label' => $label,
-        'variant' => 'text',
-      ],
+      '#type' => 'html_tag',
+      '#tag' => 'a',
+      '#value' => $this->t('All @kind', ['@kind' => $label]),
       '#attributes' => [
         'class' => ['db-instances__title-link'],
-        'title' => $this->t('All @kind', ['@kind' => $label]),
+        'href' => $url->toString(),
       ],
     ];
-    self::applyHref($build, $url);
 
     return $build;
   }
mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Needs work » Needs review

We must keep the button to avoid bleeding on the a, added css to fix.

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs review » Reviewed & tested by the community

We must keep the button to avoid bleeding on the a, added css to fix.

OK

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • mogtofu33 committed 800c2a79 on 1.0.x
    fix: #3624842 InstancesPanel RouteNotFoundException when no...