You are here

public function DateRepeatFormTestCase::formatDateForRruleInputs in Date 7.3

Same name and namespace in other branches
  1. 7.2 date_repeat/tests/date_repeat_form.test \DateRepeatFormTestCase::formatDateForRruleInputs()

Date repeat RRULE test.

File

date_repeat/tests/date_repeat_form.test, line 557
Test Date Repeat form.

Class

DateRepeatFormTestCase
Test Date Repeat form.

Code

public function formatDateForRruleInputs($form_field_name, $date_widget_type, $date) {
  $return = array();
  switch ($date_widget_type) {
    case 'select':
      $return["{$form_field_name}[datetime][year]"] = $date['year'];
      $return["{$form_field_name}[datetime][month]"] = $date['month'];
      $return["{$form_field_name}[datetime][day]"] = ltrim($date['day'], '0');
      break;
    case 'text':
    case 'popup':
      $return["{$form_field_name}[datetime][date]"] = "{$date['year']}-{$date['month']}-{$date['day']}";
      break;
  }
  return $return;
}