Problem/Motivation

Since generated media are saved into the site's own Image and SVG Image media types, the "Generate image with AI" tab is an extra tab right after Image. When a media field allows only one media type, such as the Featured image field on Varbase and Drupal CMS pages, core's Media Library renders no tab menu at all, so the AI tab never shows and the library opens straight on the upload form.

Steps to reproduce

  1. Install AI Media 1.0.x with the image generator mapped to the Image media type.
  2. Edit a page whose Featured image field allows only Image.
  3. Open the field's Media Library: there are no tabs, only the upload form.

Proposed resolution

When the allowed types include a type with a mapped, shown AI tab, build the menu even for a single allowed type, so it reads "Image | Generate image with AI".

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

  • A single-type media field shows the type's tab and its "Generate … with AI" tab.

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Show the AI tab when a field allows only one media type.

AI-Generated: Yes

Issue fork ai_media-3633061

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 committed 608460e7 on 1.0.x
    fix: #3633061 Show the AI tab when a field allows only one media type
    
rajab natshah’s picture

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

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.