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.
As seen in the attached screenshot, showing a node's "authored on" field, the field description is not rendering for the new datetime field.
Here is the code from NodeFormController.php, which plainly includes description text:
$form['author']['date'] = array(
'#type' => 'datetime',
'#title' => t('Authored on'),
'#description' => t('Format: %format. Leave blank to use the time of form submission.', array('%format' => datetime_format_example($format))),
'#default_value' => !empty($node->date) ? $node->date : '',
);
Comment | File | Size | Author |
---|---|---|---|
#10 | Screen Shot 2014-02-09 at 16.57.55.png | 26.7 KB | vijaycs85 |
#10 | Screen Shot 2014-02-09 at 16.58.09.png | 26.81 KB | vijaycs85 |
#5 | drupal8.datetime-form.5.patch | 701 bytes | sun |
#2 | 1920778-2.patch | 477 bytes | swentel |
Screenshot_2_18_13_5_55_PM.png | 13.03 KB | jstoller |
Comments
Comment #1
tim.plunkettComment #2
swentel CreditAttribution: swentel commentedThis brings it back, but it's probably not the right approach.
Comment #3
sunWhy isn't #type 'datetime' using the 'form_element' #theme_wrapper? That's the one that handles stuff like #description in all cases.
Comment #4
swentel CreditAttribution: swentel commented@sun see
http://drupal.org/node/501428#comment-6902134 (#127)
http://drupal.org/node/501428#comment-7001644 (#133)
http://drupal.org/node/501428#comment-7046752 (#138 - patch)
for reference - it's a usability thing - which doesn't mean it was properly solved ..
Comment #5
sunColor me confused. I can't see what's wrong with the resulting HTML markup of this patch. I do not see any duplicate HTML labels or anything along those lines.
Comment #6
tim.plunkettI believe the issue was a label element for a div, not an input. Something like
Which is apparently not correct.
Comment #7
sunAh, thanks, I see. That's still the case.
Which circles back into #1829202: Make #type 'item' work outside of a form context to render a compound label + content
I guess we can go with #2 as a stop-gap fix for now, but yeah, generally not amused about that one-off datetime_wrapper theme function. That's a clear need for a generic wrapper/container/item with label/#title + #description support; i.e., exactly the thing we're working on over there.
Comment #8
jibran#5: drupal8.datetime-form.5.patch queued for re-testing.
Comment #10
vijaycs85Can't reproduce this issue anymore. Attached screenshot of both HTML5 element and normal elements with description.