Created
December 22, 2016 15:38
-
-
Save init90/fa311169a66c4d62e99f4e91fc12d49c to your computer and use it in GitHub Desktop.
drupal 7, add date field with popup calendar to custom form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $form['startdate'] = array( | |
| '#type' => 'date_popup', | |
| '#title' => t('Lesson start date'), | |
| '#timepicker' => 'timepicker', | |
| '#timepicker_options' => array( | |
| 'rows' => 6, | |
| 'minutes' => array( | |
| 'starts' => 0, | |
| 'ends' => 56, | |
| 'interval' => 4, | |
| ), | |
| 'showCloseButton' => TRUE, | |
| 'closeButtonText' => t('Close'), | |
| ), | |
| '#required' => TRUE, | |
| '#date_label_position' => 'above', | |
| '#default_value' => isset($lesson->startdate) ? date('Y-m-d H:i', $lesson->startdate) : '', | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment