Excellent work on the patch to get insert and picture to play ball together (http://drupal.org/node/1885766). I have it working locally perfectly (other than a small bug which I will ticket seperately).

In the site I am speccing out, it would be great if insert module worked in a similar fashion, is this functionality already out there, or something someone would need to patch as a new request to one or other of the 2 modules?

Thanks for the advice,
Dan

Comments

I think we'll need a patch to support insert, long time since I used insert, so check first if it works and report back.

Any tips as to how you would like to implement this? I don't have oodles of time to work on a patch, but am willing to dip my toes into the water...

You can have a look at http://drupalcode.org/project/insert.git/blob/refs/heads/7.x-1.x:/includ... for some ideas, I think we need a separate template as well. The easiest will be to do the insert as the ckeditor dialog is doing it, so you only have to care about the insert part.

If you have any questions, leave a comment and thanks for doing this.

Did anyone have a chance to look into this? If not, I may have time this week, after thinking about it all, I expect this is a patch for the insert module, not for the picture module (although feel free to let me know if you think otherwise).

Below are the changes I would need this patch to cater for, so again let me know your thoughts and I will try to consider them as I do this. The only bit I am unsure about is which theme function to use to render the new item into the insert module. Is it 'theme_picture($variables)'?

Also, once I start, I expect an issue around how to differentiate between images and breakpoint groups, but will assess that when I get to it.

Field Admin
-----------
* Below 'Enabled insert styles' add a new list titled 'Enabled insert breakpoints' which lists all the breakpoints available with an identical checkbox list - insert_styles_list() in insert.module
* Change 'Default insert style' so it says 'Default insert style/breakpoints' - in insert.module
* Populate the above list so it has breakpoints mixed in - insert_styles_list() in insert.module

Entity edit
-----------
* Rename item 'Style' with 'Style/breakpoint' - in insert-widget.tpl.php
* On insert, if breakpoint is selected, then render using a theme function

Okay, managed to have a bit of a play today, and will get a quick concept patch up tomorrow at some point so you can all see and let me know thoughts before I tidy up my code. One issue I have had which you may be able to advise me on though is using

<?php
theme
('picture', $variables).
?>

Within variables there is a part called breakpoints, so to populate this I tried out (passing in my group id):

<?php
breakpoints_breakpoint_group_load
()
?>

then passed in the breakpoint variable from that. But sadly the output source doesn't look right (double slash instead of preset name), so believe I have passed in the wrong variable. What should I use instead?
<?php
<span data-picture="">
<
span data-src="http://local.drupal7.com/sites/default/files/styles//public/testimages/judge-dredd.jpg?itok=bD6afE3x"  data-width="100px" data-height="100px"></span>
<
noscript><img typeof="foaf:Image" src="http://local.drupal7.com/sites/default/files/styles//public/testimages/judge-dredd.jpg?itok=bD6afE3x" width="100px" height="100px" alt="" /></noscript>
</
span>
?>

Thanks,
Dan

Thanks for working on this, I think it better to do the same as the ckeditor is doing, inserting an IMG tag with some metadata. Ckeditor doesn't like custom span tags.

I was just thinking what @attiks said in #6. Maybe it might make more sense to tokenize what is inserted and then process the code using an input filter? (Or regex on hook_node_view_alter()?)

That is what ckeditor dialog is doing now, it inserts an IMG tag with some data- attributes.

Status:Active» Needs review
StatusFileSize
new4.4 KB

Thanks for the advice, here is an initial patch of the current master branch using the similar functionality you suggested and a first stab at the admin UI. Let me know any thoughts, and I can amend accordingly.

Status:Needs review» Needs work
StatusFileSize
new3.96 KB

I reworked the patch a bit, it didn't apply and I changed the terminology from 'breakpoint' to picture

I have no idea if this will get accepted by the insert module, since that module is build using include for each insert type, I guess picture should use the same principle like include/image.inc

So all logic specific to picture should be moved to that file.

Besides that: nice work, it works!

Thanks. Okay, so in terms of good forum etiquette, what would be best. Shall I change the project for this ticket from Picture to Insert so it can go into that queue and get relevant feedback from their developers?

If so, I will get that happening, as would be good to get this done right, and then put somewhere for everyone to use.

Thanks,
Dan

#11 Yes feel free to change the project

Project:Picture» Insert

Changing project for this ticket, as patch has been written for insert module.

@attiks which git branch were you using for your version of the patch, as it doesn't apply for me (I was using 7.x-1.x from version control pages docs).

#14 7.x-1.x last commit is 0bd9301

Thanks, I see where I went wrong, I did a reset back to master rather than the branch, all reset locally, and appears to work now, thanks.

This looks promising! Are there any plans to commit the patch and make it work with Insert 7.x-1.3 or later versions?

I can confirm the patch from #10 works. Using insert-1.3 and latest dev of picture.

Is it possible to get alt and title attributes inserted as well with patch #10?

Issue summary:View changes
Status:Needs work» Needs review

Changing to 'needs review'. Patch is in #10.

I have been using the patch in #10 for a while and works great. CKEditor module version 1.13 and CKeditor version 4.0