The attached patch updates the module to reflect the change to the use of file entities in Media 2.x. The patch checks for the version number of the enabled media module, and uses the media/[fid] URL if using Media 1.x and file/[fid] is using 2.x.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damontgomery’s picture

Cross referencing an older and alternative (similar solution) patch.

#1371208: Linked videos point to media/<fid>, which does not exist with media module version 7.x-2.x

I think that the file/[id] solution makes sense to keep functionality, however for youtube links, the file/[id] page is now just a link to the youtube page. Ideally, it would actually be an embedded youtube player. I think it's possible to make a template page to make that happen.

Anyone else know how to style the detailed pages for files?

Update: There are tons of settings for display options here,
/admin/structure/file-types/manage/video/display

drzraf’s picture

Priority: Normal » Major
FileSize
868 bytes

confirmed since several months (and seems major to me).
updated the patch to call system_get_info when needed, removed trailing whitespaces + handles the -dev verion of the media module (where $media_info['version'] is NULL)

drzraf’s picture

ping

damontgomery’s picture

I think one of the issues is that Styles is not recommended with Media 2.x. I've personally stopped using it with Media 2.x, although if you have a site already using it, that may be an issue.

In terms of your patches, I believe their base directories are incorrect and are pointing to folders that are non default Drupal paths for modules anyway.

Create a patch for drupal.org

git diff --no-ext-diff --relative=docroot/sites/all/modules/[module-name] > [module-name]-[description]-[drupal.org-issue-number]-[drupal.org-comment-number].patch
Example: git diff --no-ext-diff --relative=docroot/sites/all/modules/ctools > ctools-patch-12345678-10.patch

Apply a patch from drupal.org

Open the file and determine where the patch will be applied. You will need to modify the 'directory' option below to specify the working directory for that patch.
git apply --directory=docroot/sites/all/modules/[module-name] [patch-name].patch

Note that you may need to modify the relative and directory paths to match your git usage and file structure a bit.

Thanks for the work and hopefully it works out. I know what it feels like to have a patch go unnoticed.

drzraf’s picture

Then please, how would I have the "use thumbnail and link image to file in teaser mode" without the Styles module ? (sample use-case)

Even if the filename isn't perfect, the patch has been correctly generated.
The file location is a module's root-based relative path, the patch uses the conventional -p1" path level and should apply cleanly with a simple git apply:
http://drupalcode.org/project/styles.git/blob/refs/heads/7.x-2.x:/contri...

damontgomery’s picture

Sorry, you were correct and I was confused. Your git patch is right. The styles module seems very oddly organized.

I don't have a simple answer for you in terms of the functionality you're looking for, I just know that the two modules (while they may work) are not recommended, and my understanding is that most people will not use them together. That would suggest that compatibility between the two will not be well maintained.

Please see here for some broad information about using Media 2.x without styles,

http://drupal.org/node/1699054

In this situation, I think you would need to create a template or pre-process for the teaser mode for images (I find templates easier). This template would wrap your file in a link. There is another issue here that you will find that File Entity now puts conditional links inside all it's file chunks and this prevents wrapping these files in that way (such as images). I modified the file_entity.tpl.php to remove these.

It's not an ideal situation, but media in Drupal is not ideal. We found File Entity and Media 2.x to be more suited for our needs, but being newer than the other solution, a lot of common functionality such as the one you described is not there.

I'd love to see a plugin for the new Media 2.x module that mirrors the Media Youtube module. I could see this module as a replacement for the built in Drupal Image Styles and allow simple functionality like linking the image to the original image file, or providing a token based link (for modals). I don't think one exists.

DamienMcKenna’s picture

FileSize
878 bytes

A minor tweak to #2 to fix some coding standards violations.