Needs work
Project:
Date Tweaks
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2011 at 08:56 UTC
Updated:
30 Mar 2015 at 09:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
developer-x commentedI am at some point - but if some industrious type wanted to show off and supply a ported version - it wouldn't hurt my feelings ;-)
Comment #2
john bickar commentedHere is the initial porting patch from Coder Upgrade. When I enable the ported module on a D7 site, I get the following errors at node/add:
This is on a content type that has a date field that is the "Text field with Date pop-up" widget.
Comment #3
brightboldThanks both of you for working on this. I'm staying tuned...
Comment #4
tim.plunkettSub!
Comment #5
marcus178 commentedsubscribing
Comment #6
d0t15t commentedsubscribe
Comment #7
dhalbert commentedI spent some time using the patch from #2 above and trying to get datetweaks to work on D7. The #process functions registered in hook_element_info() (was hook_elements() in D6) now take slightly different arguments, which causes the errors shown in #2. I tried fixing this but I don't really know what I'm doing yet: I just have the Drupal 7 Module Development book and it doesn't answer all my questions.
Also, the way the functions are named, it appears they MAY be accidentally invoked as MODULE_process_HOOK() functions by the theme processing. Or maybe they are supposed to be?
Perhaps someone with a little more experience can use this as a starting point. I don't think this small module has to change all that much for D7.
(The patch doesn't apply completely automatically because of some slight differences in the .info file. But you can do "git apply --reject foo.patch" to get it to apply most of the patch, and then fix the .info file by hand.)
Comment #8
seanbfuller commentedI've been spending some time working on this also. I think that with the changes in D7, some of the registry overrides might not be necessary anymore. I tried playing around with how the process function is being handled and found the following:
Using hook_element_info_alter() along these lines seems the cleanest way to add a processor function:
Notice that this is "proc" and not "process". Doing it this way adds our processing function after date's date_combo_element_process() function located in date.element.inc.
@dahlbert, you are correct in thinking that a function named datetweaks_process_date_combo() is being picked up. I think it's in the form of a suggested process function for a theme call. It seems to be getting called after the form elements have been "processed" and just before passing it to the theme. Also, the actual form element is coming in as a child to the $element param, so that all the references would need to be changed to $element['element'].
I *think* the difference here is one of a processor function for a field element vs. a processor for a theme function. I could be wrong, however, because like you I'm still trying to get my head around some of the new D7 stuff. In the D6 version, it seemed like the module needed to own the element a bit more in order to make things work, whereas now that element can be altered in a cleaner way.
I'm gonna keep going, but so far I'm wondering if a lot of the module can be simplified to the hook_element_alter_info() that defines two processor functions (one for combo and one for popup). The theme functions seem to be pulled directly from date's code, so I don't think we'd need those either. I'll submit a patch shortly and report back if I run into any issues.
Comment #9
seanbfuller commentedHere's a second round based on my notes in #8 above. It was made against 6.x-1.x in git, incorporating some of the changes in the first patch. It still has a way to go, but it seems to be creating some of the classes and most of the critical errors are gone. Some additional notes and todos:
As I said, still a ways to go, but this at least gets rid of some of the major errors that were showing up and fixes some of the changes to how various elements are structured in D7. I haven't touched the JS yet, so some of the fixes could be there. I'm sure I've missed some things, so feedback would be much appreciated.
Comment #10
seanbfuller commentedA bit more testing after I posted this and I came across two more issues with the patch above:
Not sure if this is because I'm setting it in the wrong place, due to the change regarding the form processor vs the theme processor, or is because I removed the theme functions and something else what happening there. The footprint of how much the module is overriding seems cleaning this way (as mentioned above), and I wonder if just changing the classes and selectors would be a better way forward so we can keep that.
Comment #11
cajmcmahon commented+1
Comment #12
d0t15t commentedwhere does one find the d7 version to test this with?
Comment #13
dhalbert commented@#12: See the patch attachment in comment #2. But it will not work at all as is; that is just an automatically-generated first start at a D7 version.
Comment #14
rv0 commentedsub
Comment #15
john bickar commentedThere is a working timepicker patch to the date_popup module at http://drupal.org/node/233047#comment-4808300. That may be helpful for folks waiting for Date Tweaks functionality.
Comment #16
nagiek commentedHere's my contribution to this issue. I know it's been a while, but hey, it helps!
Any of the original maintainers still interesting in committing a D7 version?
Comment #17
hannessthanks nagiek!
i tired it and it does not work, which versions are you using?