Created
May 23, 2013 12:18
-
-
Save opi/5635657 to your computer and use it in GitHub Desktop.
Quick'n'dirty solve for media pdf bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Implements hook_preprocess_media_views_view_media_browser() | |
| */ | |
| function mymodule_preprocess_media_views_view_media_browser(&$vars) { | |
| foreach ($vars['rows'] as $delta => $row) { | |
| if ($row->filemime == 'application/pdf') { | |
| // See http://drupal.org/node/1743040 | |
| $vars['rows'][$delta]->preview = l( | |
| '<div class="media-item media-item-pdf">'.$row->filename.'</div>', | |
| 'media/browser', | |
| array( | |
| 'html' => TRUE, | |
| 'attributes' => array( | |
| 'data-fid' => $row->fid, | |
| ), | |
| 'query' => array( | |
| 'render' => 'media-popup', | |
| 'fid' => $row->fid | |
| ), | |
| ) | |
| ); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment