Problem/Motivation

Each media type with a generator adds its own "Generate … with AI" tab to the Media Library. On a site with Image, SVG Image and Video that makes 8 tabs instead of 5, and the AI path sits away from the upload it replaces. Editors think "I need an image", then choose how to add it.

Steps to reproduce

  1. Open the Media Library from a field or the editor that allows Image, SVG Image and Video.
  2. See three extra "Generate … with AI" tabs in the tab list.

Proposed resolution

  • Add a third choice to "Where should the AI tabs appear?" (tab_position): Inside the tab of its media type. The tab list is core's, and inside Image, SVG Image and Video a small switch reads "Upload | Generate with AI New" ("Add" for Video).
  • Each mode keeps its own URL (ai_media=1), so it works with the Media Library's AJAX and without new state.
  • Keep "Right after the tab of their media type" and "After all the other tabs" for sites that want standalone tabs.
  • Make the new choice the default for new installs.
  • Style it with the admin theme's own variables, for Gin and Default Admin; labels never wrap.
  • Editors without a provider see no switch; administrators see "Not set up" and the setup message.

AI-Generated: Yes

Remaining tasks

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

User interface changes

  • New setting choice; by default the AI option is a switch inside each media type's tab.

Media Library, Image tab in Upload mode with the Upload | Generate with AI switch

 empty description, Examples button and info button

Media Library, SVG Image tab with the switch

Media Library, Video tab with the switch and the New badge

Add Image page with the switch

API changes

  • None.

Data model changes

  • tab_position accepts inside, the new default.

Release notes snippet

  • Generate with AI can sit inside each media type's tab in the Media Library, as a switch next to Upload.

Issue fork ai_media-3633799

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Merge request: !30

The Media Library keeps core's tabs, and Image, SVG Image and Video start with an "Upload | Generate with AI" switch. The Add media page has the same switch. Screenshots from a local Varbase 11 site in Gin:

Media Library, Image tab in Upload mode with the Upload | Generate with AI switch

 empty description, Examples button and info button

Media Library, SVG Image tab with the switch

Media Library, Video tab with the switch and the New badge

Add Image page with the switch

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

  • rajab natshah committed 718f071c on 1.0.x
    feat: #3633799 Offer Generate with AI inside each media type tab, as a...
rajab natshah’s picture

Status: Active » Fixed
Issue tags: +ai_media-1.0.0-beta1

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.