Closed (fixed)
Project:
Imagefield Crop
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2008 at 09:36 UTC
Updated:
26 Feb 2008 at 10:03 UTC
When a node form contains an imagefield_crop field, form groups on the page fail to become collapsible. This is because imagefield_crop.js breaks when Drupal.imagefield_crop.ratio is not set to something. Javascript bails because it can't find the ratio property, and collapse.js never gets to install its $(document).ready function to make collapsible form groups. The solution is to change the _imagefield_crop_widget_form function so that Drupal.imagefield_crop is always set to a valid value. For example:
if ($field['widget']['enforce_ratio']) {
list($w, $h) = explode('x', $field['widget']['resolution']);
$ratio = $h/$w;
} else {
$ratio = 0;
}
drupal_add_js('Drupal.imagefield_crop = { ratio: '.$ratio.' }', 'inline');
Comments
Comment #1
yhager commentedThanks, committed.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.