Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
media system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Jul 2017 at 14:58 UTC
Updated:
21 Aug 2017 at 02:50 UTC
Jump to comment: Most recent, Most recent file








Comments
Comment #2
wim leersAdded screenshots to show situation in HEAD.
Comment #3
wim leersI propose these alternative default configuration files, which solve the following problems:
\Drupal\media\Plugin\Field\FieldFormatter\MediaThumbnailFormatteruses extends\Drupal\image\Plugin\Field\FieldFormatter\ImageFormatterand pretends it works for everything, even though it only works for images… (field_types = {"entity_reference"}vsfield_types = {"image"})So the proposed alternatives:
Comment #4
wim leersI think this means we must remove
MediaThumbnailFormatter, since it can very easily result in completely broken output. Plus, it's not clear what purpose it would serve.Note: if we want to do this in a separate issue, I'm happy to do that too. But the patch in #3 is already removing the only references to this. And there apparently is zero test coverage for this. (We apparently missed that in #2831274: Bring Media entity module to core as Media module.)
Comment #5
marcoscano+1 for removing the formatter.
In this case, however, we may need to update the CR (or create a new one) because some contrib modules may be relying on it (I personally don't think many are, but just in case).
I have manually tested #4, everything works as expected. I was going to RTBC but just found that we have:
inside
media.schema.yml. Shouldn't we remove it as well?Comment #6
chr.fritschI removed
field.formatter.settings.media_thumbnailfrom the media.schema.yml.Comment #7
marcoscanoThanks @chr.fritsch! RTBC'ing in the assumption tests will pass.
Comment #8
wim leers#5: So glad you caught that!
Comment #9
dawehnerIs there a reason we couldn't fix the thumbnail formatter instead? The thumbnail is guaranteed to be a valid URI, so I don't see why it shouldn't be theoretically possible to render an img tag to that. In case it isn't, is there any value in the thumbnail in the first place, when you cannot display it? Could we remove it across the entire module as well? This would be a great simplification.
The usage of the word "broken"
Comment #10
marcoscanoRe: #9:
I may be missing the point (sorry if it's the case), but isn't the thumbnail a basefield of type
image, and then, viewable by any formatter that can be applied to image fields?Out of the box, we are indeed using the Tumbnail information in the Media listing in
/admin/content/media:so I see value in having the basefield, even if the formatter is gone.
Comment #11
wim leersPer #9 and #10, sounds like this needs more review. I had forgotten
MediaThumbnailFormatterwas intended for thethumbnailbase field. I should've read the code.The reason it looks as broken as it does for me is #2889438: Delete media delivered icons on uninstall — I only had

no-thumbnail.png, I didn't havegeneric.pngbecause of that! The correct screenshot is:(Updated the IS to use this one.)
Indeed. And guess what: nothing uses the
media_thumbnailformatter! Notviews.view.media(/admin/content/media) which is shown in #10, nor the default File & Image displays.However, #3 and #4 are plain wrong: nothing was broken because of the
MediaThumbnailFormatter! Removing that is out of scope here. Updated IS + title. Working on updated patch.Sorry for the sloppiness on my side.
The patch is now only about improving the default entity view displays.
Comment #12
dawehnerAh this makes sense now.
Indeed, but maybe it should actually?
Is there a reason we cannot go visually hidden? I assume it would be better accessibility wise to have the label still around.
Comment #13
wim leers#12: I was contemplating that too :)
Comment #14
dawehnerI think this totally make sense.
One less thing site builders have to change to even make sort of a positive impact.
Comment #16
wim leersRetesting, re-RTBC.
Comment #18
xjmComment #19
xjmAs I think @dawehner started to say in #9, please don't use words like "broken" and "useless". They create an unnecessarily negative tone and interfere with the progress of an issue.
Attaching screenshots of the configuration screen at Admin -> Structure -> Media types for the File and Image media types' entity displays, to illustrate the changes for the site builder.
In HEAD
File configuration:
Image configuration:
With the patch
File configuration:
Image configuration:
So I definitely agree with:
I'm less sure about:
Removing the author and created fields. In the case of embedding the rendered media entity in a media field, they are probably not useful. But in the case of administering site media (i.e. viewing the media entity directly), they could be useful information, in the same way that the node author is useful information. I'm confused by:
How is this the case? If they seem to be created by someone else, that would seem like a bug? I tested and it seems to report the correct user.
Edit: I guess this means that the file itself isn't necessarily created by the user who uploaded it, e.g. a content editor didn't take the photo that they're adding to the article. However, I think it's also very common for users to upload files that they created themselves. And, regardless, it's useful information to know who put that image on your site or who submitted the file. So this doesn't seem like a reason one way or the other to me. I think it's more about what's most commonly useful to site builders so that they have less to configure.
Removing display of the image thumbnail. (Note that the summary does not match the current patch. In the current patch, the image thumbnail is hidden and the default "medium" image style is displayed.) When Media is viewed directly, the site builder might want to see what the thumbnail will look like, and compare it to the full image. This is useful for e.g. an image gallery or user profile directory, where you might want to compare the thumbnail that will be used in a view to the style that will be displayed on the full page.
It probably still makes sense to go forward with those two changes as well, because the File and Image plugins are mainly intended as replacements for core file and image, and the 80% usecase is probably just displaying the normal file formatter and displaying a reasonably-sized version of the image. For creating advanced displays of the media, the site builder would probably be reconfiguring things anyway; the current display is not really well-suited to that usecase either. However, I did want to document the questions since I considered them.
Leaving at RTBC for the moment to think about it some more. The greatest advantage of doing this soon is probably that it makes #2831943: Use "rendered media" (not links) as default media field formatter; add modal to configure the used media view mode straightforward; using files and images in Media fields is probably much more common than viewing their entities directly.
Comment #20
xjmComment #21
larowlanYes, I agree that the 80% use case is the normal file/image formatter. On most client sites I've worked on access to /media/x or file/x in case of D7 is rare, and when clients do find themselves there, they find it confusing. They're much more likely to use /media/x/edit or file/x/edit than the full page view.
Comment #24
xjmThanks @larowlan. That's confirmation enough to overcome my waffling. Committed and pushed to 8.5.x. I also backported it to 8.4.x since it's a strategic initiative, etc. and we've still a full week before the beta deadline.