As seen in the attached screenshot, showing a node's "authored on" field, the field description is not rendering for the new datetime field.

Screenshot_2_18_13_5_55_PM.png

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 : '',
    );
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Title: Field discription doesn't render on datetime field » Field description doesn't render on datetime field
swentel’s picture

Status: Active » Needs review
FileSize
477 bytes

This brings it back, but it's probably not the right approach.

sun’s picture

Why isn't #type 'datetime' using the 'form_element' #theme_wrapper? That's the one that handles stuff like #description in all cases.

swentel’s picture

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

sun’s picture

FileSize
701 bytes

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

tim.plunkett’s picture

I believe the issue was a label element for a div, not an input. Something like

<label for="edit-date-time-wrapper">Date</label>
<div id="edit-date-time-wrapper"> ... </div>

Which is apparently not correct.

sun’s picture

Ah, 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.

jibran’s picture

#5: drupal8.datetime-form.5.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, drupal8.datetime-form.5.patch, failed testing.

vijaycs85’s picture

Issue summary: View changes
Status: Needs work » Closed (cannot reproduce)
FileSize
26.81 KB
26.7 KB

Can't reproduce this issue anymore. Attached screenshot of both HTML5 element and normal elements with description.