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

yhager’s picture

Status: Active » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.