imagefield_crop_widget.inc =================================================================== --- imagefield_crop_widget.inc (revision 2645) +++ imagefield_crop_widget.inc (working copy) @@ -231,6 +231,22 @@ } function imagefield_crop_widget_value($element, $edit = FALSE) { + + // Because the output of this field changes depending on the button clicked, + // we need to ask FAPI immediately if the remove button was clicked. + // It's not good that we call this private function, but + // $form_state['clicked_button'] is only available after this #process + // callback is finished. + // This is also used in filefield_widget_process(). + $filefield_remove = array( + '#name' => implode('_', $element['#parents']) .'_filefield_remove', + '#value' => t('Remove'), + '#post' => $element['#post'], + ); + if (_form_button_was_clicked($filefield_remove)) { + return; + } + if ($edit && isset($edit['data'])) { $file = field_file_load($edit['fid']); $field = content_fields($element['#field_name'], $element['#type_name']);