Include image on edit media detail screen for Image asset

Created on 30 August 2023, 10 months ago
Updated 23 November 2023, 7 months ago

Problem/Motivation

When viewing a DAM asset at media/{id}/edit, the image itself does not appear. It would be useful if the image appeared at a larger size on this detail screen:

Steps to reproduce

1. Go to /admin/content/media
2. Click on "Edit" next to a DAM Image asset
3. Mapped fields appear and are editable, but no image appears.

Proposed resolution

Include an image on the edit details screen for a DAM Image asset. Use the “pseudo field” technique of Field API to allow sitebuilders to handle this preview image on the form display mode config pages just like any other “real” fields of the entity types. The raster image file itself for the thumbnail can be acquired from the core's Media API as it is a mandatory field to have every media item of Drupal.

Feature request
Status

Fixed

Version

1.0

Component

User interface

Created by

🇺🇸United States nessthehero

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nessthehero
  • Assigned to Balu Ertl
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺
  • @balu-ertl opened merge request.
  • Status changed to Needs review 9 months ago
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺

    A first draft solution is ready for testing on the merge request. The only deviation from the requirements defined in the ticket description is that all media bundles defined by this module have their previews displayed on their subtype editor pages:

    The reason why I left the MR in Draft status is that there are a couple of points to possibly further improve the feature:

    1. We could use a Twig template for rendering the markup instead of concatenating raw HTML only. If going this way, then some label above the image could be useful.
    2. Decide on which terminology, “preview” or “thumbnail” shall we use for this image. I believe abiding by naming conventions matters.
    3. Probably test coverage would be necessary as well.

    Also updating IS regarding the changes.

  • Status changed to Needs work 9 months ago
  • 🇺🇸United States mglaman WI, USA

    This needs work. It can be simplified using existing checks to see if a media type has our source plugin.

  • First commit to issue fork.
  • Status changed to Needs review 8 months ago
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺

    The default acquia_dam_asset_item widget plugin has been extended with an extra render array item of the thumbnail image which is being fetched directly from the remote DAM software.

    (Drupal keeps local copies of thumbnails as managed files only for displaying them on entity lists but not on entity forms.)

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    199 pass
  • Status changed to RTBC 8 months ago
  • 🇺🇸United States nessthehero

    I can only test the "DAM - Image" content type since I don't think we have any other kinds of content in our DAM (and I don't have the ability to create/add assets to it), so I can mark this as RTBC for that aspect!

    Excellent work! It should be documented somewhere that in order for the thumbnail to appear, you have to move the "Asset Reference" field out from the disabled fields on the Form Display settings for the DAM - Image media type.

    Thanks!

  • Status changed to Fixed 8 months ago
  • 🇺🇸United States japerry KVUO

    We'll look at adding it as default later on. so for now, fixed!

  • Issue was unassigned.
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 7 months ago
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺
Production build 0.69.0 2024