Steps to reproduce
- create a view (block, not a page)
- add exposed filters
- disable ajax
filters wont work.

We added the module "views block filter block"
https://www.drupal.org/project/views_block_filter_block So we could place the exposed filters also in a block.

The filters return this error now:
PHP message: Uncaught PHP Exception InvalidArgumentException: "You cannot create a URL to a display without routes." at /data/web/radio2/htdocs/web/core/modules/views/src/ViewExecutable.php line 1926

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wouters_f created an issue. See original summary.

wouters_f’s picture

Any advice on the fix in the patch is more than welcome.

osman’s picture

(almost) same here.

1. Create a views block,
2. expose terms via BEF to render them as links
3. Drupal warns `Exposed filters in block displays require "Use AJAX" to be set to work correctly.`
4. enable AJAX for that display
5. save

Upon rebuilding the cache and refreshing the page displaying that block view, I get the following error message.

btw, I tried both 8.x-3.0-alpha2 and the dev snapshot (commit ID:`5888e68b6c6c7147a9e7b90a71cf56d35edc4466`), ended up with the same error.

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: You cannot create a URL to a display without routes. in Drupal\views\ViewExecutable->getUrl() (line 1926 of core/modules/views/src/ViewExecutable.php).
Drupal\views\Plugin\views\display\DisplayPluginBase->getUrl() (Line: 1003)
Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters->exposedFormAlter(Array, Object) (Line: 120)
Drupal\views\Form\ViewsExposedForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('views_exposed_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('views_exposed_form', Object) (Line: 135)
Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm() (Line: 1225)
Drupal\views\ViewExecutable->build(NULL) (Line: 1378)
Drupal\views\ViewExecutable->execute(NULL) (Line: 1441)
Drupal\views\ViewExecutable->render() (Line: 117)
Drupal\views\Plugin\views\display\Block->execute() (Line: 1617)
Drupal\views\ViewExecutable->executeDisplay('block_news_health', Array) (Line: 78)
Drupal\views\Element\View::preRenderViewElement(Array) (Line: 37)
Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 203)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func('Drupal\block\BlockViewBuilder::preRender', Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 448)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 226)
__TwigTemplate_58c303d92ca32dce6e56a4758b916e125d181589ee438889124811b0d72acad6->doDisplay(Array, Array) (Line: 381)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 355)
Twig_Template->display(Array) (Line: 366)
Twig_Template->render(Array) (Line: 64)
twig_render_template('themes/sag/templates/layout/page.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 167)
__TwigTemplate_96eaf279d632a61838b0b42d3b5919c2ba25b3c22f9b9d52eefb306e3408613d->doDisplay(Array, Array) (Line: 381)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 355)
Twig_Template->display(Array) (Line: 366)
Twig_Template->render(Array) (Line: 64)
twig_render_template('themes/sag/templates/layout/html.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 147)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 148)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
osman’s picture

Seems like the 8th branch still inherits quite a bit of 7.x API.

A quick look into `theme_select_as_links()` shows usage of `request_uri()`, `filter_xss()`, `drupal_html_id()`, `theme()`, etc. These functions are not available in 8.x, hence the errors.

If you need to use the link formatter for the exposed filters, I suggest wait for an update, or find an alternate solution, checkboxes seems to be working.

FiNeX’s picture

I confirm that checkboxes and radio buttons are working, instead links returns a WSOD with the following error (I'm not using views_block_filter_block module):

Uncaught PHP Exception InvalidArgumentException: "You cannot create a URL to a display without routes.

Mschudders’s picture

I can confirm that patch #2 is working.

However if you have additional exposed filters like a "title" it doesn't work.
Rephrased, they do not work together.

jover’s picture

New patch available, because patch #2 was not compatible anymore with 8.x-3.x

maaty388’s picture

Status: Needs review » Reviewed & tested by the community

Ok, thank you for patch #7 works for me.

ryross’s picture

#7 also works for me

  • mikeker committed d554c78 on 8.x-3.x
    Issue #2859094 by wouters_f, jover: Exposed filters block not showing on...
mikeker’s picture

Status: Reviewed & tested by the community » Fixed

Thank you, @wouters_f and @jover, for the patch and reroll/cleanup! Apologies for the delay getting to this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

zenimagine’s picture

I tested and the patch does not work for drupal 8.4

sinn’s picture

Yes, doesn't work with Drupal 8.4.3

StijnStroobants’s picture

Patch was not succesfully applying. I think because of the wrong line-numbers.
I had to apply the changes manually.

Rerolled the patch and is working for me with Drupal 8.4.3 and Better Exposed Filters 8.x-3.0-alpha3