Fix for imagefield in other form

  1. function epvext_photos_page_form($form_state) {
  2.   $form = array();
  3.   drupal_load('module', 'filefield');
  4.   module_load_include('inc', 'imagefield', 'imagefield_widget.inc');
  5.   module_load_include('inc', 'content', 'includes/content.node_form');
  6.  
  7.   $image_people = content_fields('field_enterprise_image_people', 'enterprise');
  8.  
  9.  
  10.   $form['#attributes']['enctype'] = 'multipart/form-data';
  11.   $form['type']['#value'] = 'enterprise';
  12.  
  13.  
  14.   $form['field_enterprise_image_people'][0] = imagefield_widget(&$form, &$form_state, $image_people, array());
  15.   $form['field_enterprise_image_people'][0]['#type_name'] = $image_people['type_name'];
  16.   $form['field_enterprise_image_people'][0]['#field_name'] = $image_people['field_name'];
  17.   $form['field_enterprise_image_people'][0]['#delta'] = 0;
  18.   $form['field_enterprise_image_people'][0]['#multiple'] = TRUE;
  19.  
  20.   $form['submit'] = array(
  21.     '#type' => 'submit',
  22.     '#value' => t('Valider'),
  23.   );
  24.  
  25.   return $form;
  26. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.