Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291721

Exposed date filter leads to a notice

$
0
0

Problem/Motivation

Adding a exposed filter to a view, and going to that view page leads to a notice, Notice: Undefined index: type in Drupal\views\Plugin\views\filter\Date->acceptExposedInput() (line 125 of core/modules/views/src/Plugin/views/filter/Date.php).

Date::acceptExposedInput is called two times in the views rendering build process (ViewsExecutable::build()) , first time through $exposed_form->renderExposedForm() and second time through $this->build('_filter'). Date::acceptExposedInput is aware that calling its parent will unset the 'type' property it's using, and thus try to restore it.

There's a few early return before the reset though, and when those early return hits, the second acceptExposedInput call won't find the array key it's looking for.

Proposed resolution

Restore the 'type' key before any early return in Drupal\views\Plugin\views\filter\Date::acceptExposedInput().

Steps to reproduce

Starting from a Standard profile installation:

  1. Go to /admin/config/development/logging , and display all messages.
  2. Go to /admin/structure/views/view/content
  3. Add a filter on the "Authored on" field, expose it to site visitors, saves the view
  4. Go to /admin/content

At this point, you'll be greeted with the aforementioned notice. Note that it doesn't show up in the view preview.


Viewing all articles
Browse latest Browse all 291721

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>