Problem/Motivation
Exposed forms in Views may be set to "Input required" so that results are only shown when at least one filter is selected.
Since this setting might affect logic in other places (like filter options handling), so it would be handy to determine whether this setting is active. Moreover, the Better Exposed Filters module extends the InputRequired class, but adds another similar setting.
Proposed resolution
Add an isInputRequired() public method to ExposedFormPluginInterface and implement it in core implementations (classes ExposedFormPluginBase and InputRequired).
User interface changes
None.
API changes
See above.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | interdiff_10-13.txt | 901 bytes | mrshowerman |
| #13 | 3300701-13.patch | 2.6 KB | mrshowerman |
| #12 | 3300701-nr-bot.txt | 2.86 KB | needs-review-queue-bot |
| #10 | 3300701-10.patch | 2.6 KB | smustgrave |
| #10 | interdiff-6-10.txt | 722 bytes | smustgrave |
Issue fork drupal-3300701
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mrshowermanComment #3
mrshowermanComment #4
mrshowermanComment #5
smustgrave commentedLooks like patch #4 failed to apply. Moving back to NW
Comment #6
mrshowermanThere was a name clash with between the
inputRequired()method and theInputRequiredclass.Renamed the method to
isInputRequired().Comment #7
smustgrave commentedSince this is a feature request it may not need a test case but won’t be surprised if it is requested.
Comment #8
lendudeNot sure about needing this, since it's using a specific plugin class I would just do
$plugin instanceof InputRequired, but ¯\_(ツ)_/¯And yes it does need tests (it doesn't need a test-only patch for features)
Comment #9
mrshowermanThe idea of providing a method for it came from the fact that Better Exposed Filters is sub-classing
InputRequiredwhile adding a custom setting that controls whether input is really required or not. So simply checking for$plugin instanceof InputRequiredwouldn't return the correct result when said setting is set tofalse.Of course, one could argue why on earth there can be cases where an
InputRequiredsubclass may not require input. But in my opinion it's a much easier solution than rewriting Better Exposed Filter's plugin.Comment #10
smustgrave commentedUploaded a simple assertion.
Comment #11
smustgrave commentedComment #12
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #13
mrshowermanFixed
{@inheritdoc}syntax.Comment #14
smustgrave commentedSelf review.
It will need change record for new functions
Comment #15
smustgrave commentedAdded a simple change record.
Think I'm good to review this ticket as my contribution was the tests and not the actual fix.
Comment #17
smustgrave commentedSeems to be random failure. Restarted tests.
Comment #19
mrshowermanI guess it's a random failure again. Re-started tests.
Comment #20
catch@lendude wasn't convinced about this before, so moving back for subsystem maintainer review again.
Comment #21
smustgrave commentedBrought this up in #needs-review-queue-initiative channel and seem we may need a new solution. Was pointed out #9 says this could be done in contrib technically. Reason that this must live in core?
Comment #23
smustgrave commented@lendude blast from the past. Wonder if #9 answers your question?