Issue #3586397: Fix AI settings form fails to load when allowed_hosts is an empty string
Description
Testing instructions
- Reproduce the bad state:
ddev exec drush php:eval "\Drupal::configFactory()->getEditable('ai.settings')->set('allowed_hosts', '')->save();" - Clear caches:
ddev exec drush cr - Visit
/admin/config/ai/settings, expand Advanced Settings → Generated Content External Link Security. - Confirm the page loads without error and the Trusted Domains textarea is empty.
- Add a domain (e.g.
example.com), save, reload — verify it persists. - Check stored config:
ddev exec drush cget ai.settings allowed_hosts
Should show a YAML sequence, not an empty string.
Checklist
- I have linked the related issue in the MR title or description
- I have performed a self-review of my own code
- I have added or updated tests, or explained in the description why this change is not covered by tests
- I have updated documentation for any new or changed functionality
- I have written testing instructions and verified them locally
- I have noted any required post-merge steps (config imports, cache rebuilds, manual changes)
- This MR contains no breaking API or hook changes, or they are explicitly documented in the description
AI Compliance
Note
Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.
-
AI Assisted Code
Mainly written by a human; AI used for autocomplete or partial generation under full human supervision. -
AI Generated Code
Mainly generated by AI, reviewed and approved by a human before this MR was created. -
Vibe Coded
Generated by AI and only functionally reviewed before this MR was created.
Closes #3586397 (closed)
Edited by Ahmad Khader