Spaces in /source
This commit is contained in:
parent
45c8708a5f
commit
6e9dd34d0f
121 changed files with 1051 additions and 1051 deletions
|
@ -3,34 +3,34 @@ title: How to add a date popup calendar onto a custom form
|
|||
nav: blog
|
||||
slug: add-date-popup-calendar-custom-form
|
||||
tags:
|
||||
- forms
|
||||
- form-api
|
||||
- date
|
||||
- calendar
|
||||
- drupal-7
|
||||
- drupal-planet
|
||||
- drupal
|
||||
- forms
|
||||
- form-api
|
||||
- date
|
||||
- calendar
|
||||
- drupal-7
|
||||
- drupal-planet
|
||||
- drupal
|
||||
---
|
||||
First, I need to download the [Date](http://drupal.org/project/date "Date module on Drupal.org") module, and make my module dependent on date_popup by adding the following line into my module's .info file.
|
||||
|
||||
dependencies[] = date_popup
|
||||
dependencies[] = date_popup
|
||||
|
||||
Within my form builder function:
|
||||
|
||||
~~~php
|
||||
$form['date'] = array(
|
||||
'#title' => t('Arrival date'),
|
||||
'#title' => t('Arrival date'),
|
||||
|
||||
// Provided by the date_popup module
|
||||
'#type' => 'date_popup',
|
||||
// Provided by the date_popup module
|
||||
'#type' => 'date_popup',
|
||||
|
||||
// Uses the PHP date() format - http://php.net/manual/en/function.date.php
|
||||
'#date_format' => 'j F Y',
|
||||
// Uses the PHP date() format - http://php.net/manual/en/function.date.php
|
||||
'#date_format' => 'j F Y',
|
||||
|
||||
// Limits the year range to the next two upcoming years
|
||||
'#date_year_range' => '0:+2',
|
||||
// Limits the year range to the next two upcoming years
|
||||
'#date_year_range' => '0:+2',
|
||||
|
||||
// Default value must be in 'Y-m-d' format.
|
||||
'#default_value' => date('Y-m-d', time()),
|
||||
// Default value must be in 'Y-m-d' format.
|
||||
'#default_value' => date('Y-m-d', time()),
|
||||
);
|
||||
~~~
|
Loading…
Add table
Add a link
Reference in a new issue