I have a view with exposed sorts but no exposed filters, enabling ctools_views hides these sorts completely.
This is because in Drupal\ctools_views\Plugin\Display\Block we have:
/**
* {@inheritdoc}
*/
public function usesExposed() {
$filters = $this->getHandlers('filter');
foreach ($filters as $filter_name => $filter) {
if ($filter->isExposed() && !empty($filter->exposedInfo())) {
return TRUE;
}
}
return FALSE;
}
Which does not check for sort handlers at all. I don't see a reason for this function override as the DisplayPluginBase class does a similar job but checks all handlers (filters, pagers, sorts).
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | interdiff.txt | 713 bytes | acbramley |
| #4 | 2878418-ctools-views-exposed-4.patch | 1.54 KB | acbramley |
Comments
Comment #2
acbramley commentedHere's a patch which removes the function so it defaults to core's Block display logic.
Comment #4
acbramley commentedCan't reproduce this failure locally, although I get another error:
I believe the failure will be due to ajax being off on the block.
Comment #6
acbramley commentedDebugging into these tests I'm not sure how they pass at all on DrupalCI.
Inspecting the raw HTML output in testDisableFilters() after the post to add the filter block to the page shows no form output whatsoever. The assertions like
$this->assertFieldByXPath('//select[@name="status"]');return a false positive in that the field can't be found, but there's no $value passed in so it skips the entire part of assertFieldsByValue and just && together an empty array and $found (which defaults to TRUE) so passes.Comment #7
erutan commentedI just ran into this, and stumbled onto ctools views as the culprit by process of elimination by nuking contrib. This feels like more than a "normal" priority issue honestly, though perhaps I'm the only one in 5 years that has tried to expose sort criteria without filters?
https://drupal.stackexchange.com/questions/310939/any-idea-why-exposed-s...
https://drupal.slack.com/archives/C6SQM2J94/p1651443238891589
Comment #8
erutan commented