Fix for Show all IMAGE fields used in a content type to select - not working

  1.   if (module_exists('content')) {
  2.     $fields = content_types($type->type);
  3.     $fields = (array)$fields['fields'];
  4.  
  5.     $options = array('' => t('None'));
  6.     foreach ($fields as $field_name => $field) {
  7.       if (strpos($field['widget']['type'], 'image') !== FALSE) {
  8.         $options[$field_name] = $field['widget']['label'];
  9.       }
  10.     }
  11.  
  12.     $form['uc_dfo']['uc_img'] = array(
  13.       '#type' => 'select',
  14.       '#title' => t('Product image field'),
  15.       '#default_value' => variable_get('uc_image_'. $type->type, NULL),
  16.       '#options' => $options,
  17.       '#description' => t('The selected field will be used on Ubercart pages to represent the products of this content type.'),
  18.       '#weight' => -4,
  19.     );
  20.   }

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.