When using sample data generated by TextItemBase::generateSampleValue(), I find it confusing that the summary will be the same as the "normal" field value. This makes it hard to spot whether the summary or the full text is used in some location.
Instead, the summary should either use a much shorter text, or just a shortened version of the full text (although the latter would make it harder to determine whether the summary or the trimmed full text is used).
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | After_patch.png | 17.25 KB | vikashsoni |
| #26 | Patch_apply_.png | 69.58 KB | vikashsoni |
| #25 | interdiff-2774445-19-25.txt | 1.02 KB | vakulrai |
| #25 | short_summary-2774445-25.patch | 2.5 KB | vakulrai |
| #23 | After Patch 2774445 Two.png | 485.6 KB | chetanbharambe |
Comments
Comment #2
willzyx commented@drunken monkey thanks for reporting.
I totally agree with you but this issue should not be filed against devel. The placeholder field values are generated by FieldItem* classes not by devel generate; in particular the value used for full text and summary is handled by TextItemBase::generateSampleValue() and the mehod does not take in account the summary setting.
I think we should move the issue to drupal core
Comment #3
drunken monkeyThanks for pointing that out, wasn't aware of this.
Moving the issue accordingly, and attaching a simple patch.
Comment #5
willzyx commentedSince the issue affect only to a specific field type ('text_with_summary' field type) I think that we could move the changes to the relative class (
TextWithSummaryItem). Also probably we need test coverage for thisComment #11
krzysztof domańskiComment #12
krzysztof domańskiComment #16
vakulrai commentedAdding a Reroll patch for 9.2.x, with modification to the
TextItemBase::generateSampleValue()method. Also adding a test for summary filed generated throughgenerateSampleValue()method.Please review.
Comment #17
vakulrai commentedAdding the Patch for #16.
Comment #18
vakulrai commentedFixed Cspell issues in #17 and resubmitting the patch.
Comment #19
vakulrai commentedSorry , Uploaded the wrong patch in #18, resubmitting.
Comment #20
vakulrai commentedComment #21
bhumikavarshney commentedTested #19 on 9.2, the summary now using a much shorter text after the patch
This can be moved to RTBC
Comment #23
chetanbharambe commentedVerified and tested patch #19.
Patch applied successfully and looks good to me.
Testing Steps:
# Goto: admin/modules
# Install Devel and Devel Generate modules.
# Goto: admin/config/development/generate/content
# Select a basic page and mention the node (2) numbers in the field
# Click on Generate
# Click on Content
# User should see generated 2 contents
# edit any content and check the summary field after applying the patch. (It should be in one line)
Expected Results:
# User should see short summary in one line.
Actual Results:
# Summary should not be longer like in paragraph format.
Looks good to me.
Can be a move to RTBC.
Comment #24
catchThis is out of scope, additionally it should be left without a period at the end (see other instances in core).
I think this should be 'Modify the final string to match the length of $min_word_count". However also why is this necessary and are these variables used at all?
Comment #25
vakulrai commentedHi @catch, I have made the changes as you mentioned.
The while loop in the code is not generating an exact N word sentence , its is going beyond that. the above snippet is just enforcing to generate the sentence equal to $min_word_count .
Comment #26
vikashsoni commentedApplied patch #19 working fine
Thanks for the patch
Comment #30
smustgrave commentedReran #25 for 10.1 and the tests pass
Also tested locally and confirm the tests fail without the fix.
Also tested locally the solution with devel generate and it worked.
Comment #31
alexpottThese changes aren't necessary or part of the fix. If we were to make this change then we should change the docs:
But I don't understand why we need to do this.
Comment #32
smustgrave commented#31.1 if we remove that code the tests added fail so think they are needed?
#31.2 min_word_count I don't follow?
Comment #36
smustgrave commentedClosed #3083954: Generated sample values for TextItemWithSummary should have short summary text as a duplicate
Comment #37
smustgrave commented@alexpott
Not sure I know what you mean.
Comment #39
smustgrave commentedGuess after so long is this still needed by chance?
Comment #41
smustgrave commentedSince there’s been no follow up going to close out. If still valid please reopen maybe updating the summary to address the why