diff --git a/date_single_day/date_single_day.module b/date_single_day/date_single_day.module index 5ebecdf..e635687 100644 --- a/date_single_day/date_single_day.module +++ b/date_single_day/date_single_day.module @@ -13,7 +13,7 @@ * Cribbed from http://www.gizra.com/content/hookwidgetsettingsalter-and-pandora */ function date_single_day_widget_settings_alter(&$settings, $op, $widget) { - $widget_types = array('date_popup'); + $widget_types = array('date_popup','date_combo','date_popup_repeat'); if ((!empty($widget['type']) && in_array($widget['type'], $widget_types)) || (!empty($widget['widget_type']) && in_array($widget['widget_type'], $widget_types))) { switch ($op) { case 'form': @@ -59,7 +59,19 @@ function date_single_day_form_alter(&$form, $form_state, $form_id) { } } } - } + } else if ($form_id == 'content_add_more_js') { + // thanks to http://benbuckman.net/tech/10/07/customizing-drupal-date-field-hookformalter-and-afterbuild + foreach ($form as $field_name => $field){ + foreach (array_keys($form[$field_name]) as $key) { + if (is_numeric($key)) { + if ( isset($form[$field_name][$key]['#type']) && in_array($form[$field_name][$key]['#type'] , array('date_popup','date_combo','date_popup_repeat'))){ + $form[$field_name][$key]['#after_build'][] = 'date_single_day_after_build'; + $form[$field_name][$key]['#theme'][] = 'date_single_day_element'; + } + } + } + } + } } /** @@ -67,7 +79,7 @@ function date_single_day_form_alter(&$form, $form_state, $form_id) { */ function date_single_day_after_build($form, &$form_state) { //dsm($form); - + // Hide the 'To' date element. // 'hidden' works; 'value' does not. $form['value2']['date']['#type'] = 'hidden';