Problem/Motivation
The block display doesn't allow exposed filters unless ajax is turned on. This seems to stem form Drupal 7 limitations. For a a view with facets to work the whole page should be refreshed, however.
Proposed resolution
Allow non-ajax blocks to have exposed filters.
This works because views always uses <current>
route when view-URL/display-path is not available, for example: http://cgit.drupalcode.org/drupal/tree/core/modules/views/src/Form/Views...
Remaining tasks
Find cases where this would be problematic.
Write tests.
User interface changes
The exposed filters appear and the wtf-moment for site builders disappears.
API changes
none
Data model changes
none
Original Issue:
Exposed filters are getting lost, when view is rendered as block
If I'm creating a block which is based on the content view page (Drupal core view - ID "content"), then the view works except of the exposed filters, e.g. filter by title. You can see the view at the Drupal 8 site's URL /admin/content/node.
I'm displaying the block in my custom template. I'm getting the block markup by my following controller method:
/**
* Gets the HTML markup for a block by it's ID.
*
* @param $sBlockId The id of the block as string.
*
* @return string The HTML markup for the rendered block.
*/
private function getBlockMarkupById($sBlockId)
{
$oBlock = \Drupal\block\Entity\Block::load($sBlockId);
$aRenderArray = \Drupal::entityManager()
->getViewBuilder('block')
->view($oBlock);
return \Drupal::service('renderer')->render($aRenderArray);
}
Everything except the exposed filters is displayed. What's wrong?
I've also seen, that the exposed filters in block views are already a problem in previous versions of Drupal. See the related issues.