Symptoms: URL of file formatter doesn't work in any view mode
Steps to reproduce:
- Install Media. Upload some PDFs or other things that would get categorized as Document.
- Set up the Media Browser in WYSIWYG and enable the filter for Full HTML (I'm hoping this is sufficient detail)
- Admin > Structure > File types > Document > Manage File Displays
- Click Preview view mode, set Large File Icon as file formatter
- Click Default view mode, set URL to file as file formatter
- Click Show row weights, make sure they're non-zero and save that (just for good measure)
- Create a new Article or something with a body field
- Click Media Browser, pick a PDF you uploaded, pick Default
Expected behavior
URL to file is embedded in content, ideally with the fancy Media JSON that makes sure it always refers to the same file even if edited (or however that is managed)
Actual behavior
I get a big fat inserted.
Observations
If I use URL to file as the Preview formatter, I do actually see the URLs as previews. So it's not flat-out broken.
Note that I upgraded from 1.2 to 2.x-unstable6, then -unstable7, then -dev just before filing this issue (Jan-10, presumably http://drupalcode.org/project/media.git/commit/133fe60). Not sure if something got messed up in the database. But I did try uploading a brand new file and embedding that to try to rule that out. I also reconfigured everything (Media Browser settings, Structure > File types) after updating of course. I think I've exhausted the options.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | media-fix_tagless_elements-1886722-10.patch | 2.5 KB | gcb |
| #9 | media-fix_tagless_elements-1886722-9.patch | 2.5 KB | ParisLiakos |
| #8 | media-fix_tagless_elements-1886722-8.patch | 637 bytes | ParisLiakos |
Comments
Comment #1
wizonesolutionsThis also happens when using URL to file with Image file types. It doesn't seem to be isolated to File fields.
Comment #2
wizonesolutionsMoving to File Entity; realized this isn't really Media's fault.
Comment #3
wizonesolutionsOpened #1886886: Order of file formatters not saved (or UI doesn't reflect it) as a possibly related issue. It's an issue in its own right, in any case.
Comment #4
ParisLiakos commentedI was able to reproduce this.
Seems to be a bug though only in media browser..
(if you do the same for a field and set this field to dipslay rendered file it works)
so re-assigning to media
Comment #5
bbinkovitz commentedI encountered this problem as well, on a clean install of the latest media module dev. All other field formatters work with their appropriate filetypes. It does not appear to generate any js errors in the console. However, attempting to use Firebug with the media browser causes the files list to be displayed twice, both non-functional. So that makes it impossible to use Firebug, and may or may not be relevant to whatever the original bug is doing.
Comment #6
arthurf commentedI am actually seeing an error here:
What it looks like is that create_macro(element) is getting called with an element that does not have any of the file data on it. I think the underlying issue here are some some assumptions about where the data for the file is being stored- this could explain the differences between some formatters working. I'm not familiar with this area of the code but it seems like this maybe a good avenue to explore.
I agree with rootatwc that this is a media wysiwyg issue.
Comment #7
arthurf commentedTesting mrfelton's patch #22 on #1792738: Allow custom file view modes for WYSIWYG display seems to fix this- it indicates that this is indeed an issue with the formatter data getting displayed in the browser. We maybe able to mark this issue as a duplicate.
Comment #8
ParisLiakos commentedIt is because the element has no html tags, so file attributes cannot be passed.try this
Comment #9
ParisLiakos commentedok well..one thing lead to another and i ended up cleaning up again..and guess what...suprise!! now all elements use the json tags..(well actually i tested only with generic files and url to files)
yay:D
please test it extensively...i tested both on tinymce and ckeditor, but the more eyes the merrier
Comment #10
ParisLiakos commentedcommitted #8..#9 does not work with script tags see #1280758: The WYSIWYG integration in media destroys <script> tags when the WYSIWYG instance is detached
http://drupalcode.org/project/media.git/commit/7c36da0
Comment #12
gcb