Closed (won't fix)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Apr 2011 at 20:12 UTC
Updated:
8 Jul 2015 at 16:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mstrelan commentedSubscribe
Comment #2
jenlamptonHere's a patch that adds insert module support (against the 2.x branch)
edit: this works for file fields because that's what I needed it for, but it should be easy to extend for image fields as well.
Comment #3
tsvenson commentedGreat start, a couple of things though:
Especially the last point needs to be fixed. All files embedded using Media should use the placeholder markup so add-on modules can make full use of it.
Wouldn't it be possible to use code from the WYSIWYG plugin to accomplish this?
Comment #4
gagarine commentedNot a duplicate but a related issue than try to solve the same usability problem: #1062304: Fill in the available fields when creating media in the WYSIWYG
Comment #5
tsvenson commentedI don't think that the existing Insert module is the right way to go. Simply because it embeds a hard link to the file, not the placeholder code Media is using.
Not using the placeholder code would deviate from everything else and will be hard to deal with for sites when for example a file is deleted.
Comment #6
aaron commentedthere's always sun's proposal for an #80170: Inline API.
Comment #7
aaron commentedfancy mockups at http://groups.drupal.org/node/8707
Comment #8
tsvenson commented@aaron: Ahh, like what I see there. If we can leverage Inline API it would be good.
Comment #9
dave reidOdd that the insert form gets put 'above' the media widget fields which seems really odd. Otherwise this seems like a good workflow improvement for users of Insert module.
Comment #10
richsky commented#2: add-insert-suport-for-media-1140404-2.patch queued for re-testing.
Comment #12
Rob_Feature commentedI tried Jen's patch from #2 without success (7.x-2x-dev from June 14, 2012). After it didn't apply cleanly I manually applied it...no insert button appears that I can see (I also tried saving the node and reopening....without success)
Comment #13
lpalgarvio commentedi totally agree with tsvenson on #5
besides the link point,
insert places a config at the node type to allow image styles to use when picking a style at the node add/edit form. these allowed styles config has nothing in common with media own presets.
it's yet another module with similar/duplicated code
but i do like the output in the node add/edit form that insert achieves.
also as side note, i do think insert's allowed styles config (styles per field per node type) is beneficial and media module could leverage that and add a similar behaviour some time in the future (another issue).
Comment #14
mrfelton commentedThere is a sandbox project Media Insert that attempts to do this. Though. not really working for me.
Comment #15
richsky commentedMy opinion on this is that Media is a nicer way to deal with media in general and the image button in wysiwyg is crap. I used this patch with 7.x-2.0-unstable5 and it was working quite well...
Comment #16
gmclelland commentedNote: there is the issue #1664418: Replace custom WYSIWYG integration and support WYSIWYG Fields module instead. Which could probably replace this functionality with the WYSIWYG Fields module. I never used it, but I think the general idea is that you would create a field for media and WYSIWYG Fields module would provide the WYSIWYG button to insert the media.
Comment #17
richsky commentedWell noted, but for me this patch was closer to give me an exploitable result than these Wysiwyg field integrations (that are nevertheless interesting), and seems to involve too many other modules.
My point is that I don't want to let users embed links or placeholder code to media not attached to the node.
A flexible way could be a media field that allow placeholder code insertion in textarea or/and (on config choice and based on module presence). Insert does it quite well for the direct insertion, imagine you don't allow editor or it can't be loaded (in panels editing), but could be improved, and a Wysiwyg button that use media for placeholder code insertion, but using it should automatically add the selected media to the node media field and should substract on delete.
See http://drupal.org/node/1062304#comment-5465854
Comment #18
quicksketchJust a note in response to @tsvenson in #3:
Insert module is absolutely, in no way, limited to outputting hard links. Every module is allowed to create *whatever* markup they like. I've had users in the past override the templates to use both Inline module and BBCode instead of HTML for example. You're given access to the entire $file object (and the Field $widget) to generate whatever output you desire to insert, it just so happens that all the default implementations generate plain HTML.
Comment #19
quicksketchThough let me backtrack a little bit from that statement, while this is true you would need to make your own Insert styles (the things that get inserted into the textarea/WYSIWYG). And unfortunately there's no way to limit image styles to a particular widget, so you'd probably end up with all of Insert's normal styles plus a bunch of styles that specifically work with Media.
Comment #20
gghh2 commentedI don't understand how you can apply this patch because all line numbers are different... Can you explain how you apply it ?
Comment #21
wulff commentedI need Insert-like functionality for a site I'm building, and I've created the attached patch which seems to do the trick for me.
It adds a "Insert media" button to each media item in the node edit form. Clicking the button inserts a Media Filter macro at the current cursor position in the body textarea. (I only need it to work with a plain textarea, so there's no wysiwyg support.)
The patch is based on code from sreynens sandbox project and the Insert module (and it doesn't depend on the Insert module).
This is just scratching my own itch, but it seems like other people have been looking for this functionality as well.
Comment #22
wulff commentedFixed indentation issue in patch.
Comment #23
gmclelland commentedThat looks interesting, but how does a user choose the media style to insert?
Comment #24
wulff commentedCurrently, they don't :P
This simple patch doesn't support any kind of configuration. It was created to satisfy a single use case: insert media using a specific view_mode and specific classes for the resulting markup.
Comment #25
gooddesignusa commentedI'm trying to use the latest patch from #22 but the insert option doesn't seem to show up while editing the field.
It looks like it has something to do with the insert function insert_widgets on line 118 of the insert.module
It seems to expect a function media_insert_widgets before it will render that option on the field settings page.
The patch from #2 use to work but no longer applies. Any tips will be greatly appreciated. Thanks in advance.
edit: ignore my post above. The latest patch has nothing to do with the insert module.
Comment #26
drupa11y commentedAny updates on this?
Comment #27
drupa11y commentedCouldn´t this feature be realized by media supporting file field sources?
Then the current modules could be used.
There´s an issue for this here: https://drupal.org/node/1139642
Comment #28
kovacsaba commentedI had similar problem with Media and Insert modules, so i wrote a small module to integrate them. I mention that this module only works with Media 7.x-1.x version.
https://drupal.org/node/2088363/git-instructions/7.x-1.x
Comment #29
devin carlson commentedI'd suggest provided Insert integration in a separate module as is done in the sandbox project referenced in #28.
Comment #31
alan d. commentedIt looks like either both related modules are either broken or targeted to a specific version or simply just near impossible to setup.
The other project is: https://drupal.org/project/insert_video that supports images too (apparently).
Anyone had any luck with these?
@Devin Carlson
Are you sure that combining this into Media is not an option?
Comment #32
marcvangendAlan D.: In that case, this should be "needs work", right?
Comment #33
alan d. commentedI was hoping that was the status what one of the maintainers was going to decide on. I didn't want to force their hands :)
Re. status, it was never "fixed" here, rather it was deferred to the other module(s), so "Closed (won't fix)" was the right status imho. Some maintainers use "Closed (works as designed)" when deciding not to implement a feature, although that normally this refers to a feature / limitation that was perceived as a bug.
https://drupal.org/node/156119
Comment #34
rainbowarrayJust wanted to add that I found an alternative that worked for me. It's a bit clunky, but it works.
You can use Advanced Entity Token (https://drupal.org/project/aet) to put a token for a media field into a body field with WYSIWYG. This worked far better for me than WYSIWYG Fields because I wanted to have the Media file selector widget on the node edit form, so content contributors could use that to update a file without having to mess with the WYSIWYG buttons, which can get a little clunky.
My use case was that I wanted to combine individual items in a media field with some HTML, and this will do the trick. I'm not using AET Insert, because that interface was pretty wonky. So I have to manually enter the filter text to get this to do what I want to do. Not glamorous, not something I'd want content editors to do, but hey, it works!
Comment #35
maxplus commentedHi,
I'm working with sandbox from #28 in combination with 7.x-2.x version and it works for me until now.
Thanks!