date_test.module 886 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @file
  4. * Contains date test implementations.
  5. */
  6. /**
  7. * Implements hook_menu().
  8. */
  9. function date_test_menu() {
  10. $items['date-test/form'] = array(
  11. 'title' => 'Test form with date element',
  12. 'description' => "Form with date element to make form related tests",
  13. 'page callback' => 'drupal_get_form',
  14. 'page arguments' => array('date_test_sample_form'),
  15. 'access arguments' => array('access content'),
  16. 'type' => MENU_CALLBACK,
  17. );
  18. return $items;
  19. }
  20. /**
  21. * Form callback. Generates a test form with date elements.
  22. */
  23. function date_test_sample_form($form, &$form_state) {
  24. $form['date_test_select'] = array(
  25. '#type' => 'date_select',
  26. '#title' => t('Sample from'),
  27. '#date_format' => 'H:i:s a',
  28. '#default_value' => array(
  29. 'hour' => 7,
  30. 'minute' => 0,
  31. 'second' => 0,
  32. 'ampm' => 'am'
  33. ),
  34. );
  35. return $form;
  36. }