Closed (outdated)
Project:
Drupal core
Version:
9.5.x-dev
Component:
text.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Jul 2009 at 19:01 UTC
Updated:
21 Dec 2023 at 15:47 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
robloachUpdated the test to test the zero length summary.
Comment #3
tic2000 commentedI wonder if in this case we should add in text_summary a check at the top so we just return '' if $size == 0.
Comment #4
dries commentedI haven't tried the patch yet but wouldn't that show -1 in the UI?
Comment #6
deekayen commentedcore tests are broken
Comment #7
tic2000 commented@Dries
I didn't try the patch either, but by looking at it I would say it will show "Unlimited" and add 0 in the UI.
Comment #8
robloachTakes tic2000's suggestion at #3 into consideration and puts a check to see if the $size is 0 before future parsing. Thanks for giving it a look, Dries. I've attached a screenshot of what it looks like to the user. Thanks!
Comment #9
tic2000 commentedelseif should be a simple if.
Note: Right now in HEAD, if I'm not mistaken,
$size = variable_get('teaser_length', 600);will always result to 600 because there is no UI available where you can change that. The UI changes teaser_length_$node->type.Comment #10
robloachThat seems like a bug to me... Should teaser_length be moved over to each the text summary length for each content type? The data is being used when it will actually never exist on a Drupal 7 installation? That seems wrong.
Comment #11
tic2000 commentedYes, but it's not this patch's issue to solve.
I have an issue opened about the teaser length #504564: Make summary length behave with fields.
A patch with elseif converted to a simple if would make this patch good to go IMO.
Comment #12
robloachTesting bot, I choose you!
Comment #13
tic2000 commentedComment #14
webchickHm. Is there a use case for this? This feels like "So install Views and create a title list then, ya knob!" ;)
But at any rate, if we change the summary length to 0, there's no reason to display the summary field.
Comment #15
tic2000 commentedInstall Views just to get a list of titles when you can get so easily that list with this change?
My main grip against the teaser length is that it gives me a list instead of a text field so I'm free to set the exact length I want with -1 or blank for unlimited. Yes I know, I can achieve that with Views too or I can _form_alter the form.
The teaser length doesn't act on the summary field, it acts on the body field when there is no summary.
Comment #16
webchickBut if the summary isn't displayed (since it's truncated to 0 characters), what's the point in displaying a field for it?
Comment #17
yched commentedSetting 'trimmed length to 0' definitely sounds more like setting the body field to 'hidden' in 'teaser' build mode - well, in the not-(yet?)-in-core Field UI...
Also note that #504564: Make summary length behave with fields aims at making trimmed length a field formatter setting, which is definitely the way forward.
Patch needs a reroll and testers.
Comment #18
webchick@yched: Oh. Duh. Yes.
In that case, that probably makes this won't fix, no?
Comment #19
tic2000 commentedIMO it doesn't. It just gives you 2 options to achieve the same thing. Also it means it gives you the option to say, if the node is not worthy of a separate summary just show the title, if it is, show the summary.
I repeat, the 0 length means the body field will be trimmed to 0. Even if the setting is set to 0, but you have a summary, the summary will still be shown. You can test that now. Set the teaser length to 200 and add a node with a VERY long summary. The summary will be in full length on the front page.
Comment #20
rooby commentedI agree with tic2000,
You can set the field display to hidden on teasers if you don't want any summary or body test on the teaser.
However, if you want to show the summary text only, and if there is not any summary text then show nothing, you cannot do that.
You can have summary or trimmed, but you can't just have summary or nothing.
This is because trim_length is set to validate using element_validate_integer_positive.
So I think we either need to be able to set trim length to zero or we have a new field formatter that is just "Summary", that will display the summary if there is one, otherwise will display nothing.
Comment #21
swentel commentedMoving to text.module - there might be other text issues in the 'field system' component.
Comment #23
noah commentedIn case anyone else comes across this thread looking to achieve this in D7, I did it with a simple custom field formatter (in a custom module):
Comment #35
smustgrave commentedThink this is outdated. Adding -1 doesn't seem like something that will be committed.
And in the manager display you can change to trimmed which shows the body and not summary.
Comment #36
smustgrave commentedSince there hasn't been a follow up, going to close for now.
Thanks