Fix for Using DATE fields on custom module

  1. function uc_otf_form_node_type_form_alter(&$form) {
  2.  
  3.   if (uc_product_is_product($form['#node_type']->type)) {
  4.  
  5.  
  6.  if (module_exists('content')) {
  7.     $fields = content_types($type->type);
  8.     $fields = (array)$fields['fields'];
  9.  
  10.     $options = array('' => t('None'));
  11.     foreach ($fields as $field_name => $field) {
  12.       if (strpos($field['widget']['type'], 'date') !== FALSE) {
  13.         $options[$field_name] = $field['widget']['label'];
  14.                 }
  15.           }
  16.          
  17.           $form['uc_otf']['uc_otf_date'] = array(
  18.       '#type' => 'select',
  19.       '#title' => t('Limited Time Offer Date field'),
  20.       '#default_value' => variable_get('uc_date_'. $type->type, NULL),
  21.       '#options' => $options,
  22.       '#description' => t('The selected field will be used on Ubercart pages to represent the products of this content type.'),
  23.       '#weight' => -4,
  24.     );
  25.    
  26.   }
  27. //  The rest of the form works fine, but does not show parts from above
  28.     $form['uc_otf'] = array(
  29.       '#type' => 'fieldset',
  30.       '#title' => t('Limited time offer settings'),
  31.       '#collapsible' => TRUE,
  32.       '#collapsed' => FALSE,
  33.       '#weight' => 2,
  34.          
  35.          
  36.       'uc_otf_overrides_desc' => array(
  37.           '#type' =
  38.                   ....
  39.                   ...
  40.                   ....

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.