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.
See the attached screenshot of a node form. It shows 4 fields:
- 1 single text field
- 1 single date field
- 1 multiple text field
- 1 multiple date field
See how date field does not conform to the standard way fields should render:
- a single date field is rendered without any label and inside a fieldset.
- a multiple date field has a label but each item is rendered as a fieldset. Help text is displayed both in each item and at the bottom of the field.
This way, it is impossible to alter or theme date fields like any other field.
Comment | File | Size | Author |
---|---|---|---|
date-fields-node-form.png | 66.19 KB | anrikun |
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedThis is not a bug. You are comparing a simple text field to an over-simplified example of a date field. Date fields are not simple fields. They are collections of field elements that can include an all day checkbox, an end date checkbox, a date field, a time field, a year field, a month field, a day field, an hour field, a minute field, a time field, and am/pm field, and a timezone field. You can't display all those elements easily or safely across themes without fieldsets.
I would say that practically no one, if anyone, is using a simple text date field with nothing else included.
Comment #2
KarenS CreditAttribution: KarenS commentedAlso, all these sub-elements are floated, to keep the form from being 5 miles long. And the fieldset keeps the floated elements contained.
Comment #3
anrikun CreditAttribution: anrikun commentedInstead of closing this, why don't you let people give their opinions about this?
At least give me a chance to submit a patch.
Or if contributions are not allowed here, tell me.
By the way, I understand that a date field may contain many sub-fields, but that does not prevent it from respecting the way a field has to be, that is, having a label and a required mark if necessary.
This is not the case here.
And descriptions should not be displayed several times.
So there is a bug.
As I said, I will submit a patch.
Comment #4
KarenS CreditAttribution: KarenS commentedThere is already a discussion about this at #1467712: Make it possible to disable fieldset for date field. We don't need two issues. I don't consider it a bug but I am willing to consider a feature request, which I already said on the other issue.
Comment #5
KarenS CreditAttribution: KarenS commentedAnd there are already other issues about things like 'required'. Please look for duplicate issues and remove them from this one. I don't know if there is anything left here that is a bug not already reported. I was marking this 'works as designed' for the fieldset, which seemed to be the primary thing mentioned in the issue.
Comment #6
arlinsandbulte CreditAttribution: arlinsandbulte commentedI agree with Karen, this is a duplicate of the other issue.
Also, you have only shown effects for 4 different field configurations in your screenshot. In reality, there are MANY more that need to be considered. See the other issue for more...