Problem/Motivation
When previewing a view display that is using this module, specifically with arguments, there is a PHP warning displayed:
Warning: Invalid argument supplied for foreach() in Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->getConfiguredViewsOptions() (line 228 of modules/contrib/entityreference_filter/src/Plugin/views/filter/EntityReferenceFilterViewResult.php).
Steps to reproduce
I'm using an exposed filter and passing a contextual argument of the form #n - argument number n of the contextual filter value
The view referenced by the exposed filter has a single contextual argument and "When the filter value is NOT available" is set to "Hide the view".
Since the contextual argument in my case is "required", previewing the view display without passing an argument results in this PHP warning.
Proposed resolution
Check $results in Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->getConfiguredViewsOptions() so that we don't try to foreach() on null.
Remaining tasks
Patch
Others to be determined
User interface changes
n/a
API changes
n/a
Data model changes
n/a
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | entityreference_filter-3230004-3.patch | 1.37 KB | star-szr |
Issue fork entityreference_filter-3230004
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:
- 3230004-pph-warning
changes, plain diff MR !4
- 3230004-php-warning-when
changes, plain diff MR !3
Comments
Comment #2
star-szrComment #3
star-szrDidn't mean to set needs review on the last comment, but here's a patch.
Comment #12
maximkashuba@Cottser thank you for the patch.
Comment #13
maximkashubaWill be merged into master branch.