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;
  }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

VianneyH created an issue. See original summary.

pifagor’s picture

Status: Active » Needs review
FileSize
398 bytes

Implemented a code patch. Work not tested.

drunken monkey’s picture

I 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.

drunken monkey’s picture

andyg5000’s picture

Status: Needs review » Reviewed & tested by the community

I 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.

rhovland’s picture

Updated patch to work with version 3.4

paulocs’s picture

I 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 :)

joelpittet’s picture

Status: Reviewed & tested by the community » Fixed
Related issues: +#2607594: Customize views block settings on each block instance

If 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

Status: Fixed » Closed (fixed)

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

japerry’s picture

Note, 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