Skip to main content
1 of 3
user avatar
user avatar

Altering ImageField Widget with FUplaod enabled

I need to alter the ImageField Widget so that I can add some fields other than the Description, Alt and Title fields. I'm able to do this when I select the file field widget type as Image Uplaod, but when I select the FUpload widget type, the changes don't take effect. Here's the code I'm using:

function bridge_widgets_imagefield_extended_widget($element, $extra_values) {
  // If you need the field or widget to conditionally add a FAPI field, use these.
  $field = content_fields($element['#field_name'], $element['#type_name']);
  $widget = $field['widget'];

  
   if( $element['#type_name'] == 'property_gallery'  ){
  global $user;
  user_load($user);
  return array(
    //This will Replace the Textfield with dropdown select for the description
    'revise' => array(
      '#type' => 'checkbox',
      '#title' => t('Revise This Description'),
       '#default_value' => isset($extra_values['revise']) ? $extra_values['revise'] : 0,
         '#attributes'=>array('class' => 'revise-check')
       ),
    'revisedby' => array(
      '#type' => 'textfield',
      '#maxlength' => 64,
      '#title' => t('Revsied By'),
     '#default_value' => ($extra_values['revise']==0) ?  NULL : $extra_values['revisedby'] ,
       ),
       'revisedon' => array(
      '#type' => 'date',
      '#title' => t('Date'),
     '#default_value' => ($extra_values['revise']==0) ?  NULL : $extra_values['revisedon'] ,

       ),
    
  );
  }
} 
user2014