Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Any chance you will be porting this to D7?
Comment | File | Size | Author |
---|---|---|---|
#22 | date_single_day-d7port-1130490-22.patch | 11.4 KB | jgullstr |
#20 | date_single_day-d7port-1130490-20.patch | 11.58 KB | jgullstr |
#17 | date_single_day-d7port-1130490-17.patch | 11.36 KB | jgullstr |
#14 | d7initialrewrite-1130490-13.patch | 10.97 KB | jgullstr |
Comments
Comment #1
joachim CreditAttribution: joachim commentedIt's unlikely I'm going to need a D7 version of this for any of my own projects for a fair while...
Consider this to be me throwing this open for anyone interested to work on it :)
Comment #2
DamienMcKennaSubscribe.
Comment #3
calefilm CreditAttribution: calefilm commentedSubscribe
Comment #4
muschpusch CreditAttribution: muschpusch commentedpfff.. i have a hard time porting this to D7. Most of the validation and altering stuff can be done with the date API. But hiding / unsetting the second date field is a pain because than date validation fails... Any idea's on this? I got it working with display none on the second date field but that shouldn't be the way to do it...
Comment #5
joachim CreditAttribution: joachim commentedIf date validation is expecting to find a value in a particular $form_state['values'] key, then you could make sure that exists by having a form element that's of #type 'value', with the right form array key.
Comment #6
joachim CreditAttribution: joachim commented@muschpusch do you want to post a patch of what you have so far? Perhaps someone else could lend a hand :)
Comment #7
incaic CreditAttribution: incaic commentedThe following worked for me:
Simply add the name of this function to your date element's [#after_build] from within a hook_form_FORM_ID_alter() function. This will make the field type 'hidden'.
This validation alter is needed as date_combo_validate() checks for empty. This will make the 'hidden' to_date the same as the from_date.
FYI: It would have been better to use _date_combo_pre_validate_alter() as it would be easier/cleaner to copy from_date to to_date since both values are available. BUT, in date_combo_validate() the $form_state values, for some reason, are stored in 2 variables $item and $posted before calling drupal_alter() and are used for validation afterwards. So any changes to $form_state from a custom alter function are ignored. Posted the date module issue here: http://drupal.org/node/1981548
Comment #8
joachim CreditAttribution: joachim commentedThanks for posting your findings.
I you could post your changes as a patch, I'll commit them to a new D7 branch :)
Comment #9
markdavidzahn CreditAttribution: markdavidzahn commentedI desperately need this for Drupal 7 and am hoping a D7 branch is available soon. I don't quite have the know-how to implement #7 above.
Comment #10
joachim CreditAttribution: joachim commented@markzahn: Modules here are maintained by volunteers, and this particular one is not maintained much at all, because the site I developed it for is long gone and I don't have the free time to work on it. What you could do is hire yourself a developer to complete the porting work, and have them post their work in the form of a patch here. I can then commit it and make a D7 release.
Comment #11
manoloka CreditAttribution: manoloka commentedincaic can you provide a patch for 7#?
Comment #12
incaic CreditAttribution: incaic commentedSure ... but can't promise a time frame.
Comment #13
NWOM CreditAttribution: NWOM commentedAwesome. I'm glad to hear. I could really use this as well. Thanks in advance!
Comment #14
jgullstr CreditAttribution: jgullstr commentedHere's a patch for an initial Drupal 7 version. A setting for single day is provided to date_select, date_text and date_popup widgets. It is, however, currently only ever tested on date_popup.
Comment #15
NWOM CreditAttribution: NWOM commentedThank you so much jgullstr for working on the port. I went ahead and tried testing it, and noticed that it errors out on an unlimited field when clicking "Add Another" date.
The following error message is displayed:
PHP Fatal error: Cannot use string offset as an array in date_single_day.module on line 121
I know that this is still in progress, but I figured this might help. Thanks again.
Edit: It also shows the same error message when saving the node with only one date added. I'm assuming it has a problem with multiple dates in general.
Comment #16
jgullstr CreditAttribution: jgullstr commentedThanks for the feedback NWOM, I will check it out in the next couple of days.
Comment #17
jgullstr CreditAttribution: jgullstr commentedSome updates. Should work better with multi-dates now.
Comment #18
jgullstr CreditAttribution: jgullstr commentedComment #19
NWOM CreditAttribution: NWOM commentedWorks perfectly! Thanks so much. I was able to create new nodes, edit nodes, etc without any problems.
However I noticed prior that the patch does not work against the main release, and also the dev branch via git. I instead used your entire patch and removed all "-" lines by hand etc.
Comment #20
jgullstr CreditAttribution: jgullstr commentedPrevious patch was against master branch, here's one for 6.x-1.x. Also added an isset condition for widget settings in date_single_day_date_popup_process() to avoid notices.
Comment #21
joachim CreditAttribution: joachim commentedJust a couple of minor points:
Not sure why this dependency line gets moved around.
This is fine as it is, but it's quicker to just check the $info array for the presence of the 'date_popup' widget.
Comment #22
jgullstr CreditAttribution: jgullstr commentedThanks for your comments, joachim. I replaced the date dependency with date_popup (Date is inherited from date_popup). Removed module_exists() since date_popup is already a dependency. Also removed date_select and date_text from hook_widget_info_alter, as they did not work anyway. I think this version might be ok for a 7.x-dev release.
Comment #23
7nomad CreditAttribution: 7nomad commentedContent-type having the date field is referenced using entity reference with widget type Inline entity form. Patch #22 worked for me when I created nodes normally. When I tried to create node using Inline entity form. I got an error
A valid date is required for End date value #1
Comment #24
drubage CreditAttribution: drubage commentedDoes anyone have a D7 version put together for download instead of these patches?
Comment #25
joachim CreditAttribution: joachim commentedPatch in #22 doesn't apply I'm afraid.
BTW, if anyone would like co-maintainership (or indeed, ownership) of this project, please do say!
Comment #26
jgullstr CreditAttribution: jgullstr commentedI'd be happy to help out developing and maintaining a stable D7 branch of this module.
Comment #27
joachim CreditAttribution: joachim commentedGreat! I've filed an issue for that, so it's a bit more formal: #2168057: Request for co-maintainers.
Comment #28
jgullstr CreditAttribution: jgullstr commentedI have just commited a 7.x-2.x branch of this module. An alpha1 release should be available for download in a few hours. Please test it out and report possible errors as new issues. Setting issue to "Closed (fixed)".
Comment #29
sachbearbeiter CreditAttribution: sachbearbeiter commentedthanks a lot
sb