Issue #3586658: Threshold type Ajax dropdown fails to refresh fields on response_time sensor form

Closes #3586658.

Fixes the Ajax rebuild of the response time sensor edit form. Changing the Threshold type dropdown (or any other Ajax-triggering select on the sensor form) was silently failing with a PHP 8 TypeError in implode(), leaving the thresholds wrapper un-replaced.

Root cause

ResponseTimeSensorPlugin::buildConfigurationForm() assumed excluded_paths was always an array. On an Ajax rebuild EntityForm::copyFormValuesToEntity() has already written the raw textarea string onto $entity->settings['excluded_paths']; the plugin's submitConfigurationForm() would normalize that string back to an array, but submit handlers don't run on rebuilds. So the next buildConfigurationForm() call saw a string and blew up:

TypeError: implode(): Argument #2 ($array) must be of type ?array, string given
in ResponseTimeSensorPlugin.php:79

Fix

Normalize the textarea value to an array during form validation via #element_validate, so the value lives as an array in form state and is copied back onto the entity as an array. The stored type is now invariant across rebuilds.

  • Added splitExcludedPaths() as an #element_validate callback — splits on newlines, trims, filters empty entries, writes back to form state.
  • Simplified the #default_value computation with a defensive is_array() fallback so configs mis-saved as strings by the previous buggy code path still load.
  • Removed the now-redundant splitting code from submitConfigurationForm(); the submit handler override disappears entirely since the parent's submitConfigurationForm() does nothing.

Backwards compatibility

No config schema or API change. excluded_paths remains a sequence of strings.

Manual test

  1. Edit the response_time sensor.
  2. Type a path into Paths to exclude (e.g. /admin/foo/*).
  3. Change the Threshold type dropdown (Exceeds → Falls). Before this MR: watchdog TypeError, threshold fields don't refresh. After: threshold fields refresh normally, sensor saves correctly.

Merge request reports

Loading