Exposed Entity reference filter criteria gives internal server error on edit in the Views UI.
Filter criteria was successfully added and works when filtering the View.
But when I try to edit the filter criteria, I see an error in the browser console.
Also, the admin UI doesn't display the selected value, it just says 'exposed'.
Steps to reproduce:
- Create a View of content
- Add a filter on 'Authored by'
- Expose the filter
- Set the default value to a user (admin (1))
- Apply
- Try to open the edit dialog for the filter
Expected result: Dialog opens
Actual result: Dialog doesn't open and throws a server error:
POST http:///example.com/admin/structure/views/ajax/h..._export_1/filter/uid?_wrapper_format=drupal_ajax 500 Internal Server Error 324ms
"NetworkError: 500 Internal Server Error - http://example.com/admin/structure/views/ajax/handler/articleslistexport/rest_export_1/filter/uid?_wrapper_format=drupal_ajax"
uid?_wr...al_ajax
AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/ajax/handler/articleslistexport/rest_export_1/filter/uid
StatusText: Internal Server Error
ResponseText: {}
administration-reports-recent log messages shows-
Location http://example.com/admin/structure/views/ajax/handler/articleslistexport/rest_export_1/filter/uid?_wrapper_format=drupal_ajax
Referrer http://example.com/admin/structure/views/view/articleslistexport/edit/rest_export_1
Message InvalidArgumentException: The #default_value property has to be an entity object or an array of entity objects. in Drupal\Core\Entity\Element\EntityAutocomplete::valueCallback() (line 68 of /home/ubuntu/projects/drupal/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php).
Severity Error
Comment | File | Size | Author |
---|---|---|---|
#10 | 2839440-10.patch | 605 bytes | Pavan B S |
#7 | 2839440-6.patch | 605 bytes | Lendude |
Comments
Comment #2
ruplah CreditAttribution: ruplah commentedComment #3
ruplah CreditAttribution: ruplah commentedComment #4
cilefen CreditAttribution: cilefen as a volunteer commentedComment #5
cilefen CreditAttribution: cilefen as a volunteer commentedUsually with something like this we like to see attached a copy of the view definition exported from configuration management.
Comment #6
LendudeUpdated the IS with steps to reproduce (Some additional clicking at some point made it work again, couldn't reproduce the steps to make it work though).
When it was working $element['#process_default_value'] in
\Drupal\Core\Entity\Element\EntityAutocomplete::valueCallback
was FALSE, for some reason, it is TRUE when using the steps to reproduce.Comment #7
LendudeThis is an attempt at a fix. Fixes the issue in the Views UI.
Did a quick manual test for filtering a View and it seemed to work as expected. So don't know why that setting should ever be TRUE here.
Adding a Javascript test for this might be tricky at the moment, since PhantomJS doesn't play nice with exposing the filter currently, see #2754985: [backport] Add JavaScript test coverage for adding an exposed filter in Views UI
Comment #8
asghar CreditAttribution: asghar commentedI have tested with the patch and now expose filter working fine. Thanks
Comment #10
Pavan B S CreditAttribution: Pavan B S at Valuebound commentedRerolled the patch, please review
Comment #11
asghar CreditAttribution: asghar commentedHi @Pavan B S
I cannot see the difference between your patch and @Lendude patch.
Comment #12
Pavan B S CreditAttribution: Pavan B S at Valuebound commented@asghar when i applied the patch, it showed error message, so i rerolled the patch with the latest git update(8.3.x).
Comment #13
LendudeReroll was needed for #2776975: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase, changed one ) to a ]
Comment #14
balagan CreditAttribution: balagan at Brainsum commentedI applied patch #10 on 8.4.0-dev, and it solves the problem. Tests are still needed.
Comment #15
balagan CreditAttribution: balagan at Brainsum commentedComment #16
cilefen CreditAttribution: cilefen as a volunteer commentedI removed the "Triaged D8 major" tag because that is not the correct tag following a triage session. @balagan comment #14 seems to be an ordinary comment rather than the results of a triage.
Comment #17
cilefen CreditAttribution: cilefen as a volunteer commented@balagan That's good work so far on triage. I could give you credit if you complete and document the rest of the triage steps (even if brief). It is the only way to know if the triage has actually been completed. Here are some made-up examples of documented triage steps:
Thank you!
Comment #22
longwaveI know this is "needs tests" but going to go ahead and mark this trivial patch as RTBC anyway. I can reproduce by following the steps in the IS and the patch fixes the issue for me.
As per #2754985: [backport] Add JavaScript test coverage for adding an exposed filter in Views UI we have no exposed filter test coverage at the moment and I don't see that being fixed any time soon, but this is a simple fix that can be manually tested quite quickly - maybe we can make an exception to the "needs tests" rule here?
Comment #23
LendudeI don't think we should do #22. Now there is some incentive to add it in. Before it was just adding coverage for existing functionality, which is always going to be low priority.
The last time we worked on adding that coverage was back in de PhantomJs days. Hopefully things should be easier now. Unpostponed the other issue, and will take a fresh look at that.
Comment #25
MatroskeenI just closed exactly the same issue that I created recently: #3250352: Username views filter should not process default value twice in favor of #2920039: Views' User Name exposed group filter validation because it introduced a test that won't pass without this fix. I believe we can close this one as well, which is nice because it's Major!
@lendude, you'll probably want to transfer some issue credits before we go. It's so funny to find such duplicates ;)
Comment #26
LendudeYes lets continue this in #2920039: Views' User Name exposed group filter validation, that has more activity and also contains this fix.