-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = Webform Date Format | ||
description = Converts Webform Date Fields From American to British Format. | ||
core = 7.x | ||
package = Webform | ||
version = 7.x-1.0 | ||
project = webform_date_format | ||
dependencies[] = webform |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Code for the Webform Date Format module. | ||
* Changes all Webform date fields to use British format rather than American. | ||
*/ | ||
|
||
/** | ||
* Implements hook_webform_component_render_alter(). | ||
*/ | ||
function webform_date_format_webform_component_render_alter(&$element, &$component) { | ||
if ($element['#type'] == 'date') { | ||
$element['#process'][] = 'webform_date_format_webform_expand_date'; | ||
} | ||
} | ||
|
||
/** | ||
* Process function to re-order the elements in the date widget. | ||
*/ | ||
function webform_date_format_webform_expand_date($element) { | ||
$element['day']['#weight'] = 0; | ||
$element['month']['#weight'] = 1; | ||
$element['year']['#weight'] = 2; | ||
return $element; | ||
} |