Support from Acquia helps fund testing for Drupal Acquia logo

Comments

reubenavery’s picture

Status: Active » Needs review
FileSize
818 bytes

For your consideration, here is a patch that uses a variable_get call instead of a hardcoded 'preview' to render files in the media browser.

Status: Needs review » Needs work

The last submitted patch, media-thumbnail_view_mode-2093327-1.patch, failed testing.

reubenavery’s picture

blah here's another attempt..

slashrsm’s picture

Status: Needs work » Needs review
DravenDev’s picture

FileSize
354.91 KB

eh probado el parche pero aún la muestra de imagenes previas no se muestran en tamaño thumbnail esto es incomodo para poder trabajar, como puedo corregir este problema

reubenavery’s picture

Issue summary: View changes
FileSize
508 bytes

Re-rolled patch against latest dev release.

ParisLiakos’s picture

doesnt the media_wysiywg_view_mode module solves this issue?

merlinofchaos’s picture

Here is a much more comprehensive patch that makes this a setting for widgets and an argument that can be passed in.

Status: Needs review » Needs work

The last submitted patch, 8: 2093327-media-preview-view-mode.patch, failed testing.

merlinofchaos’s picture

Update to fix a bug I found with newly uploaded files.

merlinofchaos’s picture

Status: Needs work » Needs review
FileSize
6.27 KB

Update to fix the notices. I'm not sure why the test is failing, it doesn't SEEM related. :(

Status: Needs review » Needs work

The last submitted patch, 11: 2093327-media-preview-view-mode.patch, failed testing.

tea.time’s picture

Status: Needs work » Needs review
FileSize
7.45 KB

Updated patch from #11 to apply to latest 7.x-2.x-dev. A couple of notable changes:

Merlin's patch added a Media Browser field widget setting to allow selecting a view mode for previewing files selected in that field. I added a new view mode called "Field preview" which is used as the default here. This allows easily rendering the selected files' preview differently than the grid of thumbnails used in the media browser.

I also noticed that the view mode thus selected for the preview in a field was being used for the Media Browser for that field as well. This is because the widget setting was also passed to the JS and ended up in the querystring params for opening the browser. For the sake of differentiation mentioned above, I moved this slightly in the form element's array so it won't be passed to the JS.

jurgenhaas’s picture

What is the reason that media_get_thumbnail_preview() is using file_view_file() instead of entity_view('file')? The reason I'm asking is that we would like to include other fields into the thumbnails (e.g. title) so that better media selection will be possible by the end user.

Devin Carlson’s picture

Thanks for the patches! I think it might be best to move the addition of a new view mode and the UIs for selecting it in various places to a separate issue and add some tests.

The attached patch makes the changes to media_browser(), media_browser_build_media_item(), media_get_thumbnail_preview() and template_preprocess_media_views_view_media_browser() necessary to allow developers to customize the view mode used even if it is a bit of work:

Thumbnail page and file edit page- hook_form_alter();
Media element - hook_element_info_alter() with a #process callback.
Media browser - hook_media_browser_params_alter()

Devin Carlson’s picture

Status: Needs review » Fixed

Opened #2475613: Add UI for configuring the view mode used to display files inside the media browser to deal with adding additional view modes and a UI to configure which view mode to use when rendering files inside of the media browser.

Committed #15 to Media 7.x-2.x.

Status: Fixed » Closed (fixed)

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