feat: #3631526 Show a generated image once, large, with a full size link

Issue: #3631526 "Initialize the AI Media module"

Chunk 4 of the UX and integration plan (20 October 2026): the review step shows the result once (plan section 6.1).

Depends on !10 (closed) (3631526-media-add), which depends on !9 (closed), !8 (closed) and !6 (merged). Until those merge, this diff includes them; the change of this MR is its last commit.

What changed

  • For AI image types, core's preview column is hidden in the Media Library review step, so the image shows once. The image widget shows it in the large image style where the site has that style (otherwise its own setting). An SVG is shown as itself: image styles cannot make an SVG derivative, which left the SVG preview empty before.
  • Under the image: "Open full size in a new tab" (target="_blank", rel="noopener", the link text says it opens a new tab) and the file facts, for example "(2.49 KB, PNG, 1024 x 1024)".
  • Core's two-sentence note becomes one line: "Generated. Not saved yet: check the name and alternative text, then Save." (for documents: "check the name, then Save"). Set through the form, not a translation override.
  • Alt text help says where the text came from: "Prefilled from your description. Change it to describe what the image actually shows.", "Written by AI from the image. Check it." when "Ask AI" answered (a failed "Ask AI" that fell back to the description gets the first one), or the AI Image Alt Text button hint.
  • The same widget changes and note apply on the Add media page from !10 (closed).
  • Non-AI media types: unchanged (the form class only serves AI sources).
  • New 10-01-01-review.feature; the user guide describes the review step.

How it was tested

  • Plain Drupal 11.4 (aimplan1), Echo provider, headless Firefox: one img in the added item, the full size link with the file name, the facts line and the help text, in the Media Library and on the Add media page.
  • axe-core 4.10.2 (WCAG 2.0, 2.1 and 2.2 A and AA): 0 violations on the Media Library review step and the Add media review, in Claro, Gin and Default Admin at 1440 and 1920 (one preview in each).
  • Varbase E2E, Firefox: the new review feature, the generate feature and the Add media feature pass.
  • Kernel tests (15) pass. phpcs (Drupal, DrupalPractice), phpstan level 1, cspell, eslint, stylelint: clean.

Not tested

  • The SVG preview with a real SVG (Echo cannot answer with SVG; no paid calls in this MR).
  • "Written by AI from the image" with a real vision model (the source tracking is the same code path as Echo's answer).
  • Screen reader pass (planned with chunk 8).
  • Mobile widths (out of scope).

AI-Generated: Yes. Written with Claude Code (Claude Opus 5.5) under the Drupal AI policy; tested by the author before submission.

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release

Merge request reports

Loading
Loading