Issue #3586472: Use ai provider configuration form element and use proper...

Description

This MR adds ai_provider_configuration form element to RestrictToTopic guardrails configuration form. The form element substitutes the old implementation of provider/model/config selection with AiProviderFormHelper service.

Testing instructions

  1. Create a Guardrail here /admin/config/ai/guardrails
  2. Use "Restrict to Topic" plugin
  3. Observe the "AI Provider" form element at the bottom of the page.

While doing this change I have also fixed the Subform State usage, as it was not properly done before in AI Guardrail Form. That is why the ajax inside ai_provider_configuration form element was not working properly.

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 #3586472

Edited by Artem Dmitriiev

Merge request reports

Loading