MissingMandatoryParametersException with BEF Links and taxonomy/term/%

Created on 17 July 2020, about 4 years ago
Updated 6 September 2024, 10 days ago

HI. When setting up BEF for exposed sort displayed as LINKS, then getting this error and blank page:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("arg_0") to generate a URL for route

The problem can be solved by not using exposed sort as link or if I change one line BetterExposedFiltersWidgetBase.php getExposedFormActionUrl() function like this. But not sure if it is the right solution. Just temporary fix. Can someone provide a patch with correct solution, please?

  protected function getExposedFormActionUrl(FormStateInterface $form_state) {
    /** @var \Drupal\views\ViewExecutable $view */
    $view = $form_state->get('view');
    $display = $form_state->get('display');

    //if (isset($display['display_options']['path'])) {
    if (isset($display['display_options']['path']) && $display['display_options']['path'] != 'taxonomy/term/%' ) {
      return Url::fromRoute(implode('.', [
        'view',
        $view->id(),
        $display['id'],
      ]));
    }

    $request = \Drupal::request();
    $url = Url::createFromRequest(clone $request);
    $url->setAbsolute();

    return $url;
  }
πŸ› Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

πŸ‡¨πŸ‡ΏCzech Republic maxiorel Brno

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024