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.