Coming from the Required by Role contrib module:
#2017555-4: Does not work on date fields
Basically, the Required by Role module works by using hook_widget_form_alter() to alter the #required property for widgets for Fields.
This works for most fields, but not fields from the Date module.
I tracked down the problem, and the reason it is not working with Date fields is that when the Date module takes the widget information and constructs the editing form, it is going back to instance settings to check #required, instead of using the altered widget settings. This patch fixes it... I'm not sure if it has other implications, but maybe you would know? It seems to work correctly both for Date fields using Required by Role, and Date fields that are not using Required by Role.
Comment | File | Size | Author |
---|---|---|---|
date-respect-widget-alter.patch | 695 bytes | jhodgdon | |
Comments
Comment #1
jhodgdonComment #2
lord_of_freaks CreditAttribution: lord_of_freaks commentedWorks for me in:
Drupal 7.23
Date 7.x-2.6
Comment #3
jhodgdonProbably two "this is working" endorsements (mine and #2) are enough for a one-line patch to be considered reviewed and tested by the community? Your module's tests apparently passed as well.
Comment #4
cafuego CreditAttribution: cafuego commentedApplied to 7.x-2.x-dev.
I plead sitting on planes for 2 days to get home from DrupalCon and then spending a day passed out as my excuse ;-)
Do keep in mind that I'm not a primary maintainer for this module nor did I write any of the tests. I am also not able to push out new releases, so there probably won't be a 7.x-2.7 release of date with these fixes until a new primary maintainer turns up.
Comment #5
jhodgdonThanks! I wasn't trying to complain about anything, just explaining why I went ahead and set my own patch to RTBC. :)
Comment #6
ericclaeren CreditAttribution: ericclaeren commentedHi, works perfect for me, thanks! Hope this will be commited.
Comment #7
jhodgdonRE #6 I think it is already committed to the -dev version.