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.
API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21...
Enter a descriptive title (above) relating to class Date, then describe the problem you have found:
In the example that is provided, there is a missing ' in the default_value.
$form['expiration'] = [
'#type' => 'date',
'#title' => $this->t('Content expiration'),
'#default_value' => 2020-02-05',
];
Should be:
$form['expiration'] = [
'#type' => 'date',
'#title' => $this->t('Content expiration'),
'#default_value' => '2020-02-05',
];
Patch provided for code. Documentation page should be updated also.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3078633-code.png | 49.87 KB | cindytwilliams |
#2 | 3078633-patch.png | 45.73 KB | cindytwilliams |
date_render_element_documentation_fix.patch | 467 bytes | tim-diels | |
Comments
Comment #2
cindytwilliams CreditAttribution: cindytwilliams at Kanopi Studios commentedPatch applied cleanly and added the missing ' to the default value in the example. Screenshots attached. Marking RTBC.
Comment #3
alexpott@cindytwilliams thank you for reviewing this issue! The automated testing infrastructure tells us whether the patch applies, so we do not need people to review that.
Committed and pushed 683dda01d7 to 8.8.x and f2d39d5d3b to 8.7.x. Thanks!