Automatic insertion in a available media field via the WYSIWYG media plugin.
You have a content type with a media field and a text field with WYSIWYG.
Use case to add a media in the WYSIWYG area
- in the WYSIWYG insert a media via the media browser.
- the media is automatically added in the available media field on node save or previously via ajax.
Use case to delete a media in the WYSIWYG area
- in the WYSIWYG delete a media.
- the media is automatically removed of the media field on node save or previously via ajax.
I guess this should be an option in the field settings "Add media uploaded from WYSIWYG".
Comments
Comment #1
renat CreditAttribution: renat commentedSubscribe
Comment #2
visuaLatte CreditAttribution: visuaLatte commentedI agree. This is a wonderful module and much better than the hodgepodge we worked with in D6, but the behavior I expected was that, once I added a field such as "caption" to a video or image, that this field would appear in the overlay along with the upload function (or, it would appear after an image was selected, kind of how FileField allows you do fill in Alt and Title fields after the upload is complete).
It's not such a big deal for me, but I expect that my clients won't find it intuitive to go to the Content >> Media tab and add captions there.
Comment #3
DamienMcKennaSubscribe.
Comment #4
DamienMcKennaIt should be possible to do via the normal overlay too.
Comment #5
mattcasey CreditAttribution: mattcasey commented+1000 nateeanes... thanks for the tip to look for the tab under Content, I spent forever trying to find the fields I added!
Comment #6
Docc CreditAttribution: Docc commentedsub
Comment #7
DamienMcKennaSo, how about adding support for fields but providing disclaimers that certain field types might not work well? Simple fields like text fields (caption/description), and maybe even references (user reference, term reference) should work ok, so in the interests of improving the UX (CX = Contributor Experience?) I think it'd be worth adding.
So, given that the media add form isn't a real entity edit page, what would be the approach to add the assigned fields? If someone could point me in a direction I'll start taking a look at it.
Comment #8
emackn CreditAttribution: emackn commentedsubscribe. I dont see how this was not part of basic functionality for the module. I just thought the module was broken when it didn't show attribute fields that were added to the asset type. Is there a technical limitation as to why it doesn't work this way?
Comment #9
rootworkSubscribe
Comment #10
DanielF CreditAttribution: DanielF commentedI too would love to see this added. My clients can live the Content>Media tab, but this is the only thing now that's "bad" about the user interface for them. Bonus points if I can assign independent values for each use of some media, although I realize that's probably a ton more work.
Comment #11
rootworkAre there any module maintainers who can give tips on how we can productively help with this process? If work has been started on this feature, we can test patches and whatnot, or if work hasn't been started we can focus on this feature specifically. I agree that this seems to be the one missing piece to what is otherwise a fantastic module!
Comment #12
JacobSingh CreditAttribution: JacobSingh commentedI guess we'd want to implement something similar to the formatting form that shwos after you pick something (but different...). One of the complications here is plupload which allows multiple files at a time... although that has a multi-edit screen, depending on how many files you upload it might get nasty.
James.elliot is working on a new browser not using an iframe, so whatever we build here would likely be dependent on that change.
Comment #13
carole CreditAttribution: carole commentedsubscribe
Comment #14
Trunkhorn CreditAttribution: Trunkhorn commentedsub
Comment #15
mightaswell CreditAttribution: mightaswell commentedsubscribe
Comment #16
SanderJP CreditAttribution: SanderJP commentedI realy hope someone can make this happen anytime soon, because this is exactly what my client wants. To be able to add all information on one page, instead of adding say 20 images, then going to the media pages to add tags for each one seperately.
Maybe someone can provide tips for a temporary workaround?
Comment #17
mightaswell CreditAttribution: mightaswell commentedI'd also like the user to be able to fill in extra fields/meta data about the "media" content at the time they are creating it but it doesnt look like that capability is coming as soon as I need it so..
I though I would create a new content type called 'document' that is used for things like pdfs, docs, spreadsheets, etc. basically "office" documents.. with fields like title, description, etc.
I'd then use the media module as a 'file field' for this type instead of adding fields directly to the media type.
This will allow my users to upload these types of files using the media widget and I still get the other fields I need. I figure I could also do the same thing with audio and video by creating video and audio content types.
Does this sound reasonable?
I'm pretty new to Drupal. Is this the wrong way to go about it?
Comment #18
renat CreditAttribution: renat commentedMightaswell, hi!
Yes, this way is correct. The only problem is that we'll lost most of the advantages of Media module. For example, if you'll reuse your photo or video in another node, you'll have to insert meta data once again. In fact, it's pretty much like the way we used earlier, without Media.
Comment #19
SanderJP CreditAttribution: SanderJP commentedHey, there is already some code for this in media.module starting from line 1038 but it has the following comment:
"This section handles fields on media when media is added as a field. It is pretty unpolished, so hiding it for now."
I've just tested abit, but not very skilled in drupal programming yet, so maybe someone could have a quick look to see if that code is any good.
It does seem to work, except for the fact that it loads the media/%/edit page in an iframe and upon saving the site is loaded in the iframe, instead of closing it. Anyone an idea on how to fix that?
Comment #20
emackn CreditAttribution: emackn commented@renat, which branch/tag are you looking at? beta3?
Comment #21
renat CreditAttribution: renat commented@emackn, no, it was dev version something like two month ago. But I don't think it matters in case we keep our data in node fields, not in Media entity fields.
Comment #22
emackn CreditAttribution: emackn commentedjust saying cause that code you were referring to doesn't seem to work any longer. There is a $file variable that is used but never set to a value.
Comment #23
dddbbb CreditAttribution: dddbbb commentedI'd really like to see this functionality too (I also thought it would already be in there).
Comment #24
jerdavisAny progress on this? or on at least identifying all of the hurdles and possible solutions? This seems to be a critical expected feature.
One complication I remember being discussed at DrupalCon was the fact that we're detecting the media being submitted and assigning it to the right media type during file upload. We can't know if it's an image, video, audio, or other till the file upload has been completed, so we can't show the extra fields till that's complete.
If this is still a hurdle, why do we need to rely on file extension detection? When creating a media entity normally (IE: Not through plupload) can we not just have a user pick the media type they're adding and get all fields at once?
Perhaps this isn't a hurdle any more, if not it would be good to understand what the hurdles are and who is working on related code in which branches so that if anyone here does have the time and inclination to take this on we've got some ideas where to go.
Comment #25
SanderJP CreditAttribution: SanderJP commentedJust to be clear (read #19), there is already some code to fill in the meta data when you upload a file at the add content pages.
The code however just loads the media/*number*/edit page in an iframe of that specific file, but its very basic and needs rethinking/recoding/extending. But it's a start, and so it is already possible.
In my opinion you either need a follow-up page after uploading the content in de media launcher window to fill in the extra fields, or the fields appear after you've uploaded/selected the file in the media launcher. It would be ideal to have the fields on the same page or in the same window, not opening a new window like the code does now.
PS i'm also missing the ability to add multiple files when adding content. I have a media file field which can add unlimited number of files, but when i select multiple files in the media library only the first one selected gets added.
Comment #26
rootworkUpdating this to the latest version, as this issue is still present.
@sanderjp You should file a separate issue feature request for your P.S.
Comment #27
aaron CreditAttribution: aaron commentedwe need to make sure this works when adding/editing media from a field as well as a wysiwyg.
Comment #28
rootworkAbsolutely!
Comment #29
kingjohnnet CreditAttribution: kingjohnnet commentedsubscribe
Comment #30
emackn CreditAttribution: emackn commentedDo we need to rename this ticket to include wysiwyg in the title and create a new issue for added data via the node form?
Comment #31
bastnic CreditAttribution: bastnic commentedsubscribe
Comment #32
aaron CreditAttribution: aaron commentedbumping this up so i don't forget about it.
Comment #33
paranormals CreditAttribution: paranormals commentedSubscribing
Comment #34
victoriachan CreditAttribution: victoriachan commentedsubscribe
Comment #35
mansspams CreditAttribution: mansspams commentedsubscribe
Comment #36
dellis CreditAttribution: dellis commentedsubscribe
Comment #37
doana CreditAttribution: doana commentedThis would be a great feature and would really make media the solution for those of us who are upgrading from D6 with image assist.
Comment #38
zoon_unit CreditAttribution: zoon_unit commentedsubscribe
Comment #39
aaron CreditAttribution: aaron commentedversion change
Comment #40
camdarley CreditAttribution: camdarley commentedI subscribe too, but i think we have to think at plupload integration too (http://drupal.org/sandbox/pp/1244926).
What happen if we upload multiple files in an unlimited media field?
What about an "edit" link near of each media fields, with a colorbox or a collapsed form?
Comment #41
ZuluWarrior CreditAttribution: ZuluWarrior commentedSub,
I'm surprised this piece of connective functionality has not progressed further!
I would say though that the best solution would be to fetch the media/NUMBER/edit fields via the forms API, and slap them in the row with the multimedia asset in it. This principle would work with multiple files of different types on the content type, as each file row would be embellished with its relevant form elements.
Hook the validation and submission of the form any your ready to go, no?
Anyway, just my initial thoughts on it before I have a look in media.module...
Comment #42
bforchhammer CreditAttribution: bforchhammer commentedSubscribing
Comment #43
rickvug CreditAttribution: rickvug commentedSubscribe.
One way to implement this would be on the insert screen where one selects the image size. Have a "render with fields" checkbox there that would reveal the fields to be edited before insert. The other use case would having an edit link along with each thumbnail within the media browser. That would concievably be handled by the view configured to the the media gallery as per #1139514: Overhaul the media browser code to not use an iframe, and be more understandable, maintainable, and extendable.
Comment #44
yareckon CreditAttribution: yareckon commentedsub
Comment #45
djanousek CreditAttribution: djanousek commentedsubscribe
Comment #46
bmx269 CreditAttribution: bmx269 commentedSub
Comment #47
effulgentsia CreditAttribution: effulgentsia commentedI think this is a duplicate of #1213252: Allow media file's fields to be edited in a modal or after upload in the media widget, but please re-open this issue if there's something being proposed here that's different than what's covered there. Thanks.
Comment #48
jlyon CreditAttribution: jlyon commentedsub
Comment #49
ZuluWarrior CreditAttribution: ZuluWarrior commentedJust fyi, regarding my plan in #41, I did a little proof of concept and was able to dump a form, called from the forms api into the 'Metadata' area that is rem-med out of the current build.
Unfortunately project time lines means I don't have time to pursue this just yet. Hopefully soon I will fond time to re-visit. And if I can finish it off i'll submit a patch for review, but thats a couple of weeks of at least.
Comment #50
heyyo CreditAttribution: heyyo commented@camdarley Any update on your sandboz project ?
Since I'm using the last Media Browser Plus, the adding of multiple files to one field doesn't work anymore, no insertion is realized, even if we see it's doing something.
Comment #51
camdarley CreditAttribution: camdarley commented@heyyo: I'm not a maintainer of this project, i just mentioned it because I'm using it on my sites. Note that I use Media Browser Plus too without any problem. You should add an issue about this. Unfortunately I'm not a good developer so I can't help you actually.
You probably should contact the main maintainer: pp from the project page.
Sorry for the misunderstanding.
Comment #52
gagarine CreditAttribution: gagarine commentedI don't think #1213252: Allow media file's fields to be edited in a modal or after upload in the media widget is covering the automatic insertion in a field via the WYSIWYG media plugin.
You have a content type with a media field and a text field with WYSIWYG.
The use case to add a media in the WYSIWYG area is
- in the WYSIWYG insert a media via the media browser.
- the media is automatically added in the available media field on node save or previously via ajax.
The use case to delete a media in the WYSIWYG area is
- in the WYSIWYG delete a media.
- the media is automatically removed of the media field on node save or previously via ajax.
I guess this should be an option in the field settings "Add media uploaded from WYSIWYG".
Comment #52.0
gagarine CreditAttribution: gagarine commentedUpdated issue summary.
Comment #53
nikosnikos CreditAttribution: nikosnikos commentedThis could be done with an automatic filling during presave of fields in hook_field_attach_presave :
This code can be added in media.module (to be tested) or this can be in a separate module (in this case replace media_ by mymodule_).
You'll have to clear the cache.
There's no admin page in this code so if you want to make this work you'll have to :
1- Add a field named field_media_autofilled to your entity (I only tested it on a node but it should work on any fieldable entity)
2- Enable media filter in a "Long text and summary" field on the same entity.
Comment #54
hesham883 CreditAttribution: hesham883 commented@nikosnikos:
Thanks, I tried your code and it was great
I added the following hook to hide the field
by this way I can use image from the field to display it in views ,rules....or any other module
thanks again
Comment #55
becw CreditAttribution: becw commentedThis issue sounds really similar to #1664418: Replace custom WYSIWYG integration and support WYSIWYG Fields module instead, except that when you use WYSIWYG Fields, instead of using the "media" button in the WYSIWYG toolbar, you upload the media to a field, and then insert the field content into the WYSIWYG.
Would that workflow support this use case?
Comment #55.0
becw CreditAttribution: becw commentedUpdated issue summary.
Comment #56
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team