Problem/Motivation

After completion of #3317799: [Feature Request] Select and embed rendered media in patterns, clicking the upload/select button for image or video media fails if there are no values configured for the allowed media types in the Patternkit Media Library settings form. In cases like this, there is no clear selection of media bundles to expose for selection, so the upload/select button should be hidden from view instead.

Steps to reproduce

  • Install the Patternkit and Patternkit Media Library modules
  • Edit the Patternkit Media Library module settings and ensure no values are selected for the "Media Type Configuration" section
  • Create a new "[Patternkit] Example" block in a Layout Builder layout
  • Observe the "Select/Upload Image" button on the "Image URL" field
  • Click the "Select/Upload Image" button on the "Image URL" field
  • Observe the modal opens with no content and an error is logged to the browser console

Proposed resolution

When no configuration is available for which media types should be selectable, the select/upload button should not be available to the editor for image or video fields for the related media type.

User interface changes

  • If media bundles have not been selected for image fields in the Patternkit Media Library settings...
    • The "Select/Upload Image" button will not be shown on image fields in Patternkit block forms.
    • The "Select/Upload Image" button will not be shown on image-media fields in Patternkit block forms.
    • A notice will be displayed about this in the site status report.
  • If media bundles have not been selected for video fields in the Patternkit Media Library settings...
    • The "Select/Upload Video" button will not be shown on video-media fields in Patternkit block forms.
    • A notice will be displayed about this in the site status report.

Issue fork patternkit-3324889

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

slucero created an issue. See original summary.

slucero’s picture

Status: Active » Needs review

slucero’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and tested. Ready to be merged in for the beta 6 release.

  • 458a415 committed on 9.1.x
    Issue #3324889 by slucero, jordanpagewhite, mariohernandez: Media...
slucero’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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