Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I found a critical bug for me.
In a view, i have only a sort exposed and also the number of item per page exposed. I don't have a filter exposed, this is important to reproduce.
In the module ctools_views, a function is used to check if the form exposed has to be display.
Unfortunately, this function check only the filters. This function doesn't check if an exposed sort is available or if the number of item per page is exposed.
/**
* {@inheritdoc}
*/
public function usesExposed() {
$filters = $this->getHandlers('filter');
foreach ($filters as $filter_name => $filter) {
if ($filter->isExposed() && !empty($filter->exposedInfo())) {
return TRUE;
}
}
return TRUE;
}
Comments
Comment #2
pifagorImplemented a code patch. Work not tested.
Comment #3
drunken monkeyI ran into the same problem. The patch in #2 is a crude workaround, as it will break things if no exposed elements are present. Instead, just copying the “grandparent” code from
\Drupal\views\Plugin\views\display\DisplayPluginBase::usesExposed()
seems the correct solution.As far as I can see, the override was just meant to circumvent the normal block display's reliance on AJAX for exposed form functionality. This patch would effectively merely remove that parent class' override.
Comment #4
drunken monkeyComment #5
andyg5000I can reproduce this and have confirmed that @drunken monkey's fix works as described.
I'm not sure why the parent class only invokes the parent when ajax is enabled, but that's another story.
Comment #6
rhovland CreditAttribution: rhovland commentedUpdated patch to work with version 3.4
Comment #7
paulocsI attached a new patch for 8.x-3.x-dev. The same from #3.
I confirm that is working. This could be really committed soon.
Thanks :)
Comment #9
joelpittetIf we are just going to use the grandparent I'd much rather remove the code. Thanks for reporting and fixing this. I've committed the removal to the dev branch.
Introduced #2607594: Customize views block settings on each block instance
Comment #11
japerryNote, this caused a regression, which is being handled in #3296022: Nested view exposed form doesn't render after updating from 3.7.0 to 3.8.0