--- ../HEAD/imagefield.module 2008-05-13 10:26:22.000000000 +1000 +++ imagefield.module 2008-05-13 10:40:23.000000000 +1000 @@ -73,7 +73,7 @@ function imagefield_theme() { */ function imagefield_elements() { $elements = array(); - $elements['imagefield_widget_default'] = array( + $elements['image'] = array( '#input' => TRUE, '#columns' => array('fid', 'title', 'alt'), '#process' => array('imagefield_element_process'), @@ -98,6 +98,11 @@ function imagefield_element_process($ele // Unset the storage to keep the form from unnecessarily rebuilding. unset($form_state['storage'][$fieldname]); } + // Change the type and theme to prevent FAPI from trying to output with the + // theme_image() function. + $element['#type'] = 'imagefield'; + $element['#theme'] = 'imagefield'; + // Set an internal flag for requiredness. Prevents FAPI from interfering. $element['#image_required'] = $element['#required']; $element['#required'] = FALSE; @@ -498,7 +503,7 @@ function imagefield_file($op, $file) { */ function imagefield_widget_info() { return array( - 'imagefield_widget_default' => array( + 'image' => array( 'label' => t('Image'), 'field types' => array('image'), 'multiple values' => CONTENT_HANDLE_MODULE, @@ -734,7 +739,7 @@ function theme_imagefield_row($element) /** * FormAPI theme function. Theme the output of an image field. */ -function theme_imagefield_widget_default(&$element) { +function theme_imagefield(&$element) { $output = ''; // Always add tabledrag in case a table is created after uploads. @@ -869,7 +874,7 @@ if (!function_exists('upload_file_downlo * Menu-callback for JavaScript-based uploads. */ function imagefield_js($node_type, $fieldname) { - $field = content_fields($fieldname, $node_typ); + $field = content_fields($fieldname, $node_type); $form_state = array('values' => $_POST); $form_state['values'][$fieldname] = isset($form_state['values'][$fieldname]) ? $form_state['values'][$fieldname] : array(); @@ -906,7 +911,6 @@ function imagefield_js($node_type, $fiel $output = theme('status_messages') . drupal_render($form_element); // We send the updated file attachments form. - drupal_set_header('Content-Type: application/json; charset=utf-8'); print drupal_to_js(array('status' => true, 'data' => $output)); exit;