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