Closed (fixed)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 May 2012 at 15:00 UTC
Updated:
22 Aug 2013 at 17:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
David_Rothstein commentedThe attached patch implements that solution.
It relies on code introduced in #1268116-36: WYSIWYG does not record file usage in order to work.
Comment #2
David_Rothstein commentedNext time this patch is rerolled, it would be a good idea to change the first line above to
if ($new_ids = $entity_uuid_function('file', array($tag_info['fid']))), since I don't think it's guaranteed that function will return anything.Comment #3
Cap'taine Crochet commentedI'm trying to export entities to a features and cannot get files to be exported. I can see that the body field is updated with the file uuid, but the file itself is not a dependency, so it's not exported.
I had to implement hook_entity_dependencies then select files from file_usage that correspond to the current entity, and add them as dependencies.
Is it the intended way or we could move that hook to the patch? I could provide the updated patch if you need to.
Thanks
Comment #4
imp7 commentedI am interested in your patch Cap'taine Crochet.
I want to be able to use media files inside wysiwyg text format like this in an install profile, this looks like the best approach, thanks.
Comment #5
ParisLiakos commentedpostponing till #1268116: WYSIWYG does not record file usage is in
Comment #6
sylus commentedSetting to active as #1268116 is now in
Comment #7
sylus commentedCap'taine Crochet would you be able to show the work you did pushing file along as well?
Comment #8
sylus commentedAttaching updated patch taking into account feedback from #1...
Additionally I was able based on #3 to attach a file to send over leveraging hook_entity_dependencies:
Comment #9
sylus commentedCorrected spacing
Comment #10
David_Rothstein commentedHere's a reroll adding a hook_entity_dependencies() implementation to force the referenced file to be deployed. (It's actually a little simpler than discussed above - we can use media_filter_parse_from_fields() to do the hard work.)
Comment #11
David_Rothstein commentedFixing a typo in the code comment.
Comment #12
anfor commented#11: media-filter-uuid-1578018-11.patch queued for re-testing.
Comment #13
skwashd commentedI have a couple of sites deployed that accomplish this via the Embed Assets Field (EAF) module.
The disadvantage of the approach in this patch is that it bypasses the file usage count. Someone can delete all file/image field references to an asset and the it is deleted. The EAF approach means that the files are always properly referenced and so can't be deleted.
Comment #14
David_Rothstein commentedWhat do you mean by "bypasses the file usage count" exactly? Isn't that already solved by #1268116: WYSIWYG does not record file usage (which was committed a while ago and which this patch relies on - see discussion above)?
Comment #15
aaron commented#11: media-filter-uuid-1578018-11.patch queued for re-testing.
Comment #16
rosk0Reroll + code style fixes.
Comment #18
David_Rothstein commentedLooks like a good cleanup, except this one left off some words:
Comment #19
rosk0Good catch. Fixed.
Comment #20
David_Rothstein commentedComment #21
aaron commentedThis looks great.
Comment #22
aaron commentedCommitted to http://drupalcode.org/project/media.git/commit/13125f1