Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jun 2015 at 11:04 UTC
Updated:
3 Sep 2021 at 08:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
slashrsm commentedComment #2
primsi commentedLooks ok.
Comment #5
slashrsm commentedStill RTBC.
Comment #6
alexpottLooks like a test will be useful here to prove we don't break it.
Comment #7
wuinfo - bill wu commentedWhat is the URL? Can't find it from field setting for article content type.
Comment #8
slashrsm commentedAdded test.
Comment #13
wturrell commentedCould someone clarify steps to reproduce for this please? (a before/after screenshot would help)
For me, in 8.3.x, the label and custom help text both display correctly on the form. The dd/mm/yyyy placeholder is in the input itself.
The only widget is Datetime Timestamp and there are no widget settings.
Comment #15
andrewtur commentedHi,
I think what they are trying to say is that if you create a timestamp field on a entity the help text entered for this field is not shown on the edit/create form
Steps to reproduce:
1) install drupal8 default
2) add timestamp field to basic page content type
3) add custom help text for the timestamp field on the field edit page
4) check that the field is displayed in the edit form
5) create new content of the type basic page
6) the custom help text is not displayed but the default will be shown which is:" Format: 2017-09-29 11:34:58. Leave blank to use the time of form submission."
The desired result is that the help text you have entered for the field should be displayed in addition to the Format information.
Comment #18
justanothermark commented#15 includes steps to reproduce and this issue still exists in 8.6. However, the patch no longer applies and we needed a patch that applies so here's a re-roll (with before/after patch applies screenshots).
Comment #22
pameeela commentedUpdated IS and added screenshots from #15. I've also confirmed this is still an issue in 9.0.1.
Comment #23
pameeela commentedComment #24
raman.b commentedAddressing the failed test case
Comment #26
ranjith_kumar_k_u commentedThe above patch works fine , It shows the entered help text.
Before patch

After patch

Comment #27
ranjith_kumar_k_u commentedComment #28
paulocsRTBC+1.
Attached images to confirm.
Comment #29
catchI feel like we should be relying on the description configured (or not) by the user, and not have this default description at all to be honest - we have configurable descriptions for a reason and the current code breaks that.
Comment #30
vakulrai commentedThe description field must be configurable from the field configuration and the configured text must comes in place of "default text" on entity form.
I am adding a patch which will check if user has entered descriptions then same should appear on form else the default text should come.
Added tests.
Please review.
Comment #31
vakulrai commentedPrevious patch was broken , re uploading the patch.
Comment #32
kapilv commentedComment #33
quietone commentedPicked this for to review this evening.
The issue summary has steps to reproduce which is really helpful, thanks pameeela. The proposed resolution is a bit difficult to understand, but I think I know what is intended. There are no remaining tasks so I am not sure what still needs to be done. This will need after screen shot in the IS as well. Tagging needs summary update.
@vakulrai and @KapilV, To help reviewers add an interdiff, or a diff, whichever is appropriate. There are instructions for creating an interdiff in the handbook. If you think a diff is not needed, just add a comment stating why. Thanks.
I applied the patch locally and tested and it does work, if I understand the IS correctly.
The length of this line makes it hard to read. Split on Three lines
$element['value']['#description'] = $element['#description'] !== ''
? $element['#description']
: $this->t('Format: %format. Leave blank to use the time of form submission.', ['%format' => Datetime::formatExample($date_format . ' ' . $time_format)]);
I do not understand why the tests are added to StandardTest, which "* Tests Standard installation profile expectations.". There must be an existing test of the TimestampDatetimeWidget somewhere this can be added to. I don't know where that would be so I did
find . -iname \*timestamp\*test.php | grep -i functionaland that gave two results. And of those, this looks like the one to use, core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php. The testing should be added to this file.Comment #34
quietone commentedI tried to edit my comment to make this fix but it just keeps telling me the form is outdated. So here is the format change for 33.1
The length of this line makes it hard to read. Split on Three lines
Comment #35
kishor_kolekar commentedHey, I have tried to cover the points mentioned in #33.1
Please review
Comment #37
rinku jacob 13 commentedVerified and tested patch#35 on drupal 9.3.x-dev version. Adding screenshot for the reference.
getting output like this...
Comment #38
paulocsIn patch #35, the tests are not placed correctly.
I'll work on it.
Comment #39
paulocsThe tests are passing locally but falling with drupal test bots because I guess
Datetime::formatExample($date_format . ' ' . $time_format);are generating different time inTimestampTest.phpand inTimestampDatetimeWidget.php.Comment #42
paulocsNew patch without the default description test.
Comment #43
kleiton_rodrigues commentedThe patch #42 applies cleanly and works as expected.
looks good to me
BEFORE

AFTER

Comment #44
rescandon commentedVerified and tested patch#42 on drupal 9.3.x-dev version.
The field is displaying the custom help text
Comment #46
catchCommitted bd272a4 and pushed to 9.3.x. Thanks!
Comment #47
catchRemoving some issue credit for duplicate screenshots. Once there's a before/after screenshot of a patch on an issue, there's no need to add a second one.