Closed (outdated)
Project:
Insert
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 May 2009 at 18:15 UTC
Updated:
21 Aug 2018 at 13:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
quicksketchThe section of code that actually inserts code into the textarea or WYSIWYG is about 50 lines, the other 100 lines of the filefield_insert.js file and about 200 lines in filefield_insert.module is building up the template to actually be inserted into the textarea. Expanding to other modules like emfield would probably require a significant increase in code. In any case, this module is purely experimental and probably won't be released or expanded in any official way until I can get #417122: Allow drupal_alter() on Field and Widget Settings into CCK, because right now the whole thing is way to hacky and unstable without an adequate place to store settings.
Comment #2
quicksketchI've renamed this module to Insert to accommodate this exact problem. The new module can be used with any CCK field, though I've only just ported over the existing support for FileField/ImageField. It should definitely be possible to add this support to emfield or other fields, though for emfield I'm not sure if you'd get any benefit, since it's entire purpose is avoiding inline embed tags.
Moving to Insert module in case we want to continue this discussion.
Comment #3
pribeh commentedHi quicksketch,
As a themer, I'd love to see this implementated. I'm using cck fields (so imagefield instead of say image) primarily because they are so easy to theme and they can provide great ease for users interfacing with Drupal (insert image here, then insert image to text here). I love the insert whatever to text here workflow. The few users I've tested this with (using imagefield) love it and find it intuitive.
So the theming advantage of having video in a CCK field is that I can detect and theme for it easily as follows:
if teaser then ...
if field_image print field_image
if field_video_thumbnail print field_video_thumbnail
This way by ensuring major pieces of content are in their own field, even if they're inserted inline, us designers get to easily pull it out again for theming purposes. So having the additional ability for users to insert a video anywhere in the text area increases the options for users to alter the layout of a node (say page-blog) the way they want without removing the ease of theming/rearranging content for other displays (say teaser-blog).
Sorry if I'm just rambling.
Thomas
Comment #4
quicksketchMakes sense, thanks Thomas for explaining the use-case for your users. Anyway I'd be happy to include more implementations with Insert for reasonably popular modules, such as emfield or swftools. Depending on how big the project is or what it's focus is, I might also recommend that module implement Insert hooks in that module instead, since the module author will retain more control and be able to update the code as their APIs change.
Comment #5
johngriffin commentedI've been looking for a way to cleanly insert video into the body for a while and this might well be the best method. I should get some time to code insert support for emfield sometime over the next week. I'm guessing it shouldn't take too long, am I right in thinking that I will just have to implement:
hook_insert_widgets() - to describe where to inject our insert widget
hook_insert_styles() - to return some format options (thumbnail, full-size for example)
hook_insert_content() - to return the HTML to be inserted into the body
Am I right in that thinking? If you could write some documentation on the hooks and how to write an implementation for a new module that would be massively helpful!
Thanks :)
Comment #6
quicksketchHey johngriffin, I'm actually in the middle of an emfield implementation. The trouble with emfield is that it requires some very tricky AJAX calls to actually generate the HTML that needs to be inserted into the textarea. For example if the user posts a string into an emfield, we don't necessarily know if that's a YouTube ID or a Blip.tv ID. We actually need to ask emfield what kind of ID it is and what kind of markup that should output.
So I'd suggest standing by until that gets finished, though if you're interested here's the work I have so far (definitely NOT working at this point).
Comment #7
johngriffin commentedOk I'll wait on this patch. Do you have any idea of timescale? Does emfield provide an API to return the content for a video field, or are we relying on some hacky method which is subject to change when emfield is updated? If so perhaps we should put something in the emfield queue to let them know?
Comment #8
johngriffin commentedHi quicksketch,
I will have some time this coming week to work on this, so if you have done anything further on it could you please post your code so far and a list of todos?
thanks,
John
Comment #9
quicksketchI have not made any further progress on this fyi. If I'm working on it I'll post here.
Comment #10
aaron commentedi didn't know about this issue. i'll see what i can do to help -- btw, we've done this w/ the media module using placeholder images rather than embed code when in the browser, which seems to work fine there. also, emfield includes eminline, so maybe its functionality could be tapped.
Comment #11
fallsemo commentedSubscribe. I can help test :)
Comment #12
danny englanderSubscribing
Comment #13
AdrianB commentedSubscribing.
Comment #14
quicksketchRetitling to consolidate all the various issues.
Comment #15
stella commentedsubscribe
Comment #16
mrfelton commentedsubscribe
Comment #17
adub commentedBlocks also would be incredibly useful.
Comment #18
lubnax commentedSubscribe
Comment #19
mmaul commentedSubscribing :) I would love to see integration of the imagefield_crop module, which is what I use for 90% of client websites where non-tech users are editing content.
Comment #20
quicksketchImageField Crop should work without any of these changes see the issue over in their queue: #639578: Support for Insert?
Comment #21
pelicani commentedExcited for the dv7 version of Media.
It will handle all of our media woes.
But it isn't out yet and most of our sites won't be upgraded to get this feature.
I'll take a look at the patch above.
Perhaps others will help and we can get this useful feature up and running.
Comment #22
rhimes commentedsubscribe
Would like to see Embed Google Maps Field (http://drupal.org/project/embed_gmap) as well!
Comment #23
OpenChimp commentedThis is a great subject. I can't wait to see what comes of this...
Comment #24
pribeh commentedPlus twenty six fist pumps and pushups for embed_gmap support.
Comment #25
mstrelan commentedFor embedding GMaps see http://drupal.org/project/gmap_blocks along with #555406: Add a filter option
Comment #26
mstrelan commented@quicksketch - would it make it easier to implement if the insert button could just insert a token, for example for a video or a google map? In my experience the average user is not smart enough to use tokens on their own, but if they can upload a file and click insert and a token is displayed then I think this is a good start.
Comment #27
quicksketchInsert *could* insert anything, it just depends on the implementation of hook_insert_styles() and what theming is applied. In such a case, the theming could just be the contents of a token. In the same way, Insert module could be made to use BBCode or any other system also.
Comment #28
volongoto commentedSubscribing.
Comment #29
Melissamcewen commentedsubscribe, particularly would be useful for node reference
Comment #30
andyf commentedsubscribe - also interested in nodereferences
Comment #31
kingjohnnet commentedsubscribe
Comment #32
coworksbe commentedsubscribe
Comment #33
paganwinter commented+1 for nodereference (in a way that even when a site to moved to a different domain, all links to internal pages in the content work smoothly)
Think Linodef.
Comment #34
mstrelan commented@paganwinter - not sure you understand what nodereference fields are. But it sounds like you want the Internal path filter module.
Comment #35
lpalgarvio commentedadd support for Image fupload :P
http://drupal.org/project/image_fupload
this one can upload multiple images to a single node or multiple images to corresponding new nodes.
Comment #36
lpalgarvio commentedimage_fupload is a widget for imagefield.
Comment #37
zuriwest commented@quicksketch: what is your road map with 6.x and emfield? Has there been any development on the patch started back in November of 09?
Comment #38
achtonSubscribing.
Comment #39
mstrelan commentedOn the weekend I attended DrupalDownunder in Brisbane and the author of http://drupal.org/project/wysiwyg_imagefield spoke about his plans to incorporate this functionality in a generic way in a new version of wysiwyg_imagefield. I would suggest collaboration if this is not already happening.
Comment #40
J.B-2 commentedYes, just came across it: Wysiwyg Fields, basically seems to do a very similar thing: https://github.com/Decipher/wysiwyg_fields
Comment #41
willieseabrook commented+1 for nodereference support. subscribing
Comment #42
decipheredAs the author of Wysiwyg Fields I will put in my 2 cents.
The reason that Insert can not currently provide something like this (and the reason that I chose not to use it with Wysiwyg Fields) is that it currently it renders all the available outputs (based on the chosen formatters) during the AHAH event that FileField uses for the file upload. There is no AHAH event to use for other fields so in no case can the output be generated.
In Wysiwyg Fields I approach it differently, which with a re-write (that I'd be completely open to helping with) Insert could also do, which is when the Insert button itself is clicked an AHAH event is fired which submits the form values back to Drupal which returns with the output data for the selected formatter.
Cheers,
Deciphered.
Comment #43
quicksketchRight, that's what my patch in #6 would do (but without the #ahah property I think, I just used normal jQuery). But ultimately I found this to be both an overly-complicated and slow approach. But you're right, it's the only way to make this possible. I'm happy WYSWIYG Fields exists because for most users, all they need is to insert an image or file. It's not a perfect solution, but at least it's a simple one that is easy to use.
Comment #44
deciphered@quicksketch,
I do totally agree on the complexity, it was difficult, but I did manage to get it working to 99% of CCK fields. The only exception I know of at the moment is EMField, and that's because it doesn't define hook_elements.
While I agree with you that most only need FileField based inserts, I do think that the most important insert of all is a nodereference, because a nodereference with a Custom Formatter can be anything, it can be an ImageField that a user can update without breaking the link, it can be versioned FileField, it can be a dynamic quote, etc.
I would still be open to to discussing further with you to get the approach I took in Wysiwyg Fields into Insert, as you are more of an expert on the subject and it would benefit us both, but I 100% understand why you're opposed to the approach as it is rather tricky.
P.S. I really wish I knew about this issue and your patch before I started down my own path, could have saved me some potential grey hairs.
Cheers,
Deciphered.
Comment #45
lpalgarvio commentedi think the Media module will deprecate Insert.
it already does many things that Insert does, plus more stuff.
the way i see it, Media is the evolution of Embedded Media Field, with o FileField, ImageField, AudioField, VideoField, FileField Sources, Insert, WYSIWYG ImageField, IMCE, Styles, ImageCache and other modules mixed in.
that is, for Drupal 7.
in Drupal 6 we don't have Media and possibly will never have it.
WYSIWYG Fields deprecated WYSIWYG ImageField, which in turn does most of Insert does.
more collaboration please!
Comment #46
michaek commented@LPCA I think this issue is perhaps the best argument for why Media isn't likely to deprecate this module. Rolling in support to insert the content of any CCK field doesn't seem like something that Media ought to support. I'm not speaking against collaboration - I think it's important to avoid duplicating features unnecessarily - but that this module's purview is potentially broader than Media's.
It does seem that wysiwyg_fields duplicates Insert philosophically, but that the authors are interested in collaborating. That seems like it'll benefit everyone!
I'll be checking out both modules in the near future, and I'll be happy to add some work to seeing this issue closed.
Comment #47
michaek commentedActually, having looked at both Insert and wysiwyg_fields, I'm not convinced that either is the approach I would consider correct. Both seem to generate static HTML to be injected into the content, which seems like it introduces difficulties when the source for the inserted content changes (a file is uploaded to replace an existing file, for example). It seems better to me to use a placeholder and generate the appropriate content when the node is rendered, letting Drupal's cache mechanisms address performance concerns. I'm sure this has been dealt with elsewhere before, but I wanted to explain why I would not be likely to put work into closing this issue.
Comment #48
decipheredmichaek,
Wysiwyg Fields does not insert static HTML, it inserts a placeholder containing static HTML for the purpose of providing a preview in Wysiwyg mode, but the placeholder is converted into a Filter token on Save/Wysiwyg Detach, allowing the content to be updated if the formatter, field or other variable is changed.
Cheers,
Deciphered.
Comment #49
michaek commentedThanks, @Deciphered. That sounds like an excellent approach, and I'll look at the source before I make any further conclusions. Sorry for the misunderstanding!
Comment #50
lpalgarvio commentedi sure hope some collaboration is in place so that some modules end up merged.
it would be awesome to have the equivalent to Fields, Views or Panels for WYSIWYG + Field insertion, gallery and management as a single complete light solution
Comment #51
paganwinter commentedsubscribe
Comment #52
snater commentedWith the D6 version not being supported any more and the last move on this ticket being seven years old, I am closing this issue. Anyway, this remains being a great idea for Insert and I am trying to implement that for the module's D8 version. But instead of raising this issue from the dead, I think it is more appropriate to have a new issue for D8: #2994066: Create interface for other modules.