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.

CommentFileSizeAuthor
date-respect-widget-alter.patch695 bytesjhodgdon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Status: Active » Needs review
lord_of_freaks’s picture

Works for me in:

Drupal 7.23
Date 7.x-2.6

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Probably 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.

cafuego’s picture

Status: Reviewed & tested by the community » Fixed

Applied to 7.x-2.x-dev.

Probably 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.

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.

jhodgdon’s picture

Thanks! I wasn't trying to complain about anything, just explaining why I went ahead and set my own patch to RTBC. :)

ericclaeren’s picture

Hi, works perfect for me, thanks! Hope this will be commited.

jhodgdon’s picture

RE #6 I think it is already committed to the -dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.