Problem/Motivation
views_selective_filters currently replaces the proxied filter plugin definition with the selective filter plugin definition when building original options in Selective::getOriginalOptions().
This can remove definition metadata that the proxied filter needs in order to work correctly.
One example is webform_views' webform_submission_select_filter. That filter relies on definition values such as webform_id and webform_submission_field. When those values are lost, opening the selective filter settings form in the Views UI can trigger a fatal error because the proxied filter can no longer resolve its source webform.
Looks like this in the console (shortened)
Object { message: " An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /admin/structure/views/ajax/handler/advisor_assigned/page_1/filter/webform_submission_value StatusText: error ResponseText: The website encountered an unexpected error. Try again later.AssertionError: Cannot load the "webform" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php). Drupal\\Core\\Entity\\EntityStorageBase->load() (Line: 34) Drupal\\webform_views\\Plugin\\views\\filter\\WebformSubmissionSelectFilter->getWebform() (Line: 24) Drupal\\webform_views\\Plugin\\views\\filter\\WebformSubmissionSelectFilter->getWebformElement() (Line: 72) Drupal\\webform_views\\Plugin\\views\\filter\\WebformSubmissionSelectFilter->getValueOptions() (Line: 577) Drupal\\views_selective_filters\\Plugin\\views\\filter\\Selective->getOriginalOptions() (Line: 212) Drupal\\views_selective_filters\\Plugin\\views\\filter\\Selective->buildOptionsForm() (Line: 166) Drupal\\views_ui\\Form\\Ajax\\ConfigHandler-...
Proposed resolution
Preserve the original proxied filter plugin definition in Selective::getOriginalOptions(), while adding the Views data metadata needed by the selective filter.
This allows proxied filters to keep their original plugin identity and required definition keys, while still allowing selective filter options to be generated correctly.
Remaining tasks
- Review the patch/MR.
- Confirm the Views UI form opens correctly for affected proxied filters.
- Add or update test coverage if practical.
Issue fork views_selective_filters-3587222
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
joelpittetComment #5
joelpittetAI-generated: yes (AI assisted with investigating the problem in a project, patching a solution, and writing the issue summary/title and I reviewed the code changes, tested the resulting patch for the problem.)