- Issue created by @whereiam
When using the htools module's ExposedFormRegion plugin, a PHP warning is triggered:
Warning: Undefined array key "expose" in Drupal\htools\Plugin\views\exposed_form\ExposedFormRegion->renderExposedForm() (line 256 of modules/contrib/htools/src/Plugin/views/exposed_form/ExposedFormRegion.php).
This occurs when a filter handler does not have the 'expose' key in its options array. The warning can fill logs and may cause confusion or issues in environments with strict error handling.
1. Enable the htools module and configure a view with exposed filters using the ExposedFormRegion plugin.
2. Ensure at least one filter handler does not have the 'expose' key in its options array (this can happen with certain custom or contributed filters).
3. Render the view.
4. Observe the PHP warning in the logs or on the page (if error display is enabled).
Add a check to ensure that the 'expose' key and its 'identifier' subkey exist in the handler's options array before accessing them in renderExposedForm()
.
Example fix:
if (!isset($handler->options['expose']) || !isset($handler->options['expose']['identifier'])) { continue; }
This prevents the warning and ensures only handlers with the expected structure are processed.
- Apply the patch to add the isset() check before accessing 'expose' and 'identifier'.
- Review and test the patch with various filter configurations.
- Commit the fix if approved.
Downport
3.0
Code