## Problem / Motivation

`draggableviews_views_plugins_display_alter()` attaches the
`draggableviews.view.order_view` contextual link to **every** view display.

`draggableviews_contextual_links_alter()` then rewrites that link's
`route_name` to the display referenced by the draggable sort
(`draggable_views_reference`), e.g. `view.my_view.page_2`.

If the referenced display has a path with **required arguments** (a contextual
filter, e.g. `admin/foo/taxonomy/term/%`), the route needs `arg_0`. But the
contextual link is rendered in the context of the display that shows the sort
(often a **block** or an unrelated page) whose `$route_parameters` do **not**
contain that argument.

When Drupal renders the contextual link, URL generation fails:

```
Symfony\Component\Routing\Exception\MissingMandatoryParametersException:
Some mandatory parameters are missing ("arg_0") to generate a URL for route
"view.my_view.page_2".
in Drupal\Core\Routing\UrlGenerator->doGenerate()
```

The exception is logged on every `/contextual/render` request that includes
such a block, and the contextual link is broken for editors.

## Steps to reproduce

1. Create a view with a page display whose path has a contextual filter
(required argument), e.g. `admin/example/%`.
2. Add a block display with a Draggable Views sort referencing that page
display.
3. Place the block on a page that does not provide the argument.
4. As a user with "access contextual links", load the page (contextual
toolbar) → `MissingMandatoryParametersException` is logged.

## Proposed resolution

In `draggableviews_contextual_links_alter()`, before assigning the target
route to the link, verify the target route exists and that all of its required
path parameters are present in the current `$route_parameters`. If not, drop
the link instead of producing a broken/uncomputable URL.

## Remaining tasks

- Review MR.
- (Optional) Follow-up: properly resolve the `this` reference to the current
display so its own "Order view" link works.

Comments

alezu created an issue.