Skip to content

Commit

Permalink
Initial upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeebsUK authored Nov 9, 2016
1 parent e6c2895 commit 5d56515
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions webform_date_format.info
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
25 changes: 25 additions & 0 deletions webform_date_format.module
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;
}

0 comments on commit 5d56515

Please sign in to comment.