Posted by anonym-developer on August 5, 2011 at 6:57pm
4 followers
Jump to:
| Project: | Imagefield Crop |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | constructor, insert, widget |
Issue Summary
hey folks, there is a problem with the html-structur.
after enabling Insert for imagefield_crop, it seemed to work, but actually you can only insert the first image. there is a constructor error in the insert.js
The problem is in the line 36.
34 var widgetType = $(this).attr('rel');
35 var settings = Drupal.settings.insert.widgets[widgetType];
36 var wrapper = $(this).parents(settings.wrapper).filter(':first').get(0);
37 var style = $('.insert-style', wrapper).val();
38 var content = $('input.insert-template[name$="[' + style + ']"]', wrapper).val();
39 var filename = $('input.insert-filename', wrapper).val();the var wraper is undefined when fireing the "insert-button" in the imagefield_crop_widget. it always takes the first image.
i think it is a constructor error, because of all the html imagefield_crop is creating.
possible solution: what about to leave the div.image-preview and the drag-handler. the image-preview element, can be set display:none; etc. I think there are other modules using the html-core-structure to get their values.
what do you think? maybe other solutions for now?
btw: to get insert working you need to create a widget with hook_insert_widgets):
<?php
function settings_insert_widgets() {
return array(
'imagefield_crop_widget' => array(
'element_type' => 'managed_file',
'wrapper' => '.image-widget',
'fields' => array(
'alt' => 'input[name$="[alt]"], textarea[name$="[alt]"]',
'title' => 'input[name$="[title]"], textarea[name$="[title]"]',
'description' => 'input[name$="[description]"], textarea[name$="[description]"]',
),
),
);
}
?>Now You can easily enable the Insert-Button in your field-settings.
Comments
#1
subscribe
#2
Hi , where i must add this code..??
<?phpfunction settings_insert_widgets() {
return array(
'imagefield_crop_widget' => array(
'element_type' => 'managed_file',
'wrapper' => '.image-widget',
'fields' => array(
'alt' => 'input[name$="[alt]"], textarea[name$="[alt]"]',
'title' => 'input[name$="[title]"], textarea[name$="[title]"]',
'description' => 'input[name$="[description]"], textarea[name$="[description]"]',
),
),
);
}
?>
and what if i want use it for Multiupload imagefiled and Multiupload filefiled ,
Thanks
#3
bad support from Drupal.