Closed (won't fix)
Project:
Date
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Apr 2010 at 19:16 UTC
Updated:
22 Oct 2018 at 19:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Jackl85 commentedDo it! :)
NOTE: I USE
tag for color text! DO NOT COPY!!!1. Edit file:
date/date/date_admin.incIn line 19 you FOUND:
REPLACE WITH:
In line 109 you FOUND:
AFTER ADD:
2. Edit file:
date/date_api_elements.incIn line 147 you FOUND:
AFTER ADD:
Comment #2
Jackl85 commentedMaintainers for Date: can you insert in next release?
Comment #3
arlinsandbulte commentedIt makes things a lot easier and quicker if someone would create a patch file...
Comment #4
thekevinday commentedHere is the "patch" from #1 put in the requested format.
Comment #5
thekevinday commentedThe patch from #1 (and therefore #4) has most of the work already done, but has missed a few things.
First, the date module provides an option to use the textbox OR a select list.
To be consistent with the core select list, the size of the field cannot be provided for the cases of the select list.
I tried to fix this by wrapping the the input field in the following if condition:
<?php if (in_array($widget['type'], array('date_popup', 'date_popup_repeat'))) { ?>I guess this part based on a few lines below where
<?php if (in_array($widget['type'], array('date_select', 'date_popup', 'date_select_repeat', 'date_popup_repeat'))) { ?>can be found.If there are any more cases that need to be handled by the mentioned if condition, please correct this patch.
Second, the use of 60 as the default length is perfectly all right. However, date already has hard-coded 20 as the value. To preserve backwards compatibility, I changed the default value from 60 to 20. The changed code looks like:
<?php $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 20; ?>Third, everything about the original patch works, except for when the size gets applied as an attribute.
I have identified the location where the immediate problem occurs to be in the file:
date_popup/date_popup.module.The function to look for is
date_popup_process_date.The affected line is:
<?php '#size' => !empty($element['#size']) ? $element['#size'] : 20, ?>If I manually change the 20 to say 30, I do notice the size of the date field to change.
What this means is that for some reason
$element['#size']is not getting populated.I do not know why
$element['#size']is not getting populated nor what I need to do to make sure this gets populated (aside from what is already done).Therefore, I am marking this as needs work.
Attached is the patch from #4 with the fixes for the first and second cases mentioned in this post.
Comment #6
thekevinday commentedCustom watchdog prints showed the the array key
'#size'never was appearing in the$elementarray for the functiondate_popup_process_datein the filedate_popup/date_popup.module.However,
['#field']['widget']['size']did appear in the$elementarray.This next patch changes
date_popup/date_popup.modulesuch that<?php '#size' => !empty($element['#size']) ? $element['#size'] : 20, ?>is now
<?php '#size' => !empty($element['#field']['widget']['size']) ? $element['#field']['widget']['size'] : 20 ?>With this change in place this feature works as expected.
Please Review
Comment #7
Csabbencs commentedPlease add support for setting the size and maxlength of the textfield to Drupal 7 version of Date module too!
Comment #8
Chris CharltonI just noticed the D7 version of the date_text widget do not support size & maxlength forcing them to default to
size = 60andmaxlength = 128.I filed this issue for D7 - http://drupal.org/node/1105818
Comment #9
brad.bulger commentedi've added the textfield widget setting to the patch from #6. it's working well for me. this seems like a sensible feature to add.
Comment #10
linuzboy commentedComment #11
Renee S commentedPlease see #1105818: Provide support for #size & #maxlength for Drupal 7.
Comment #12
Renee S commentedComment #13
damienmckennaUnfortunately the D6 version of this module is no longer supported, but we appreciate the time you put into this.