task: #3633822 Write the name and alt text of a generated image with AI, and keep the Generate alt text button

Closes https://www.drupal.org/i/3633822

What changed

  • New default for the name and the alternative text of a generated image: written by AI from the image (metadata.name.source: ai, metadata.alt.source: ai), with the AI Prompts the module ships. The description the editor typed says what was asked for; the image may show something else.
  • AI Image Alt Text's button stays on a generated image whatever the alt source, so an editor can write the alt text again.
  • Sites can still choose the description, the AI Image Alt Text button, or none, per field. No update hook: pre-release, the defaults are in config/install.

Testing

  • Kernel: full suite, 87 tests pass (the two request tests that count requests pin the name to the description); phpcs and phpstan clean.
  • e2e fixtures keep the description-based name and alt the review feature checks.
  • Manually in Gin with OpenAI: generated an image in the Media Library; the name came back "Team planning website launch illustration" and the alt text "A bright editorial illustration in navy and teal tones showing a small team…", marked "Written by AI from the image. Check it.", with AI Image Alt Text's area still under the image.

Screenshots

From a local Varbase 11 site in Gin.

Generated image with the name and alt text written by AI, and the AI Image Alt Text "Generate with AI" button under it

AI-Generated: Yes

Checkpoints

  • Issue linked
  • Coding standards (phpcs, phpstan)
  • Automated tests
  • Tested manually in Gin
  • Reviewed by a human
  • Code review by maintainers

🤖 Generated with Claude Code

Edited by Rajab Natshah

Merge request reports

Loading
Loading