If you enter a non-empty summary, but leave Full text empty, then saving the node will save nothing. When re-editing the node, both the summary and Full text will be empty.
To reproduce:
1. Create a new Page or Article, or edit an existing one.
2. Click on "Edit Summary".
3. Enter some text in the summary textarea, but leave the Full text textarea empty (or delete what's there).
4. Click Save.
5. Edit the page again. Both the summary and the Full text textareas will be empty.
I have not changed the trim length from the default. This is on a fresh 7.x-dev build downloaded on 2009-10-27.
My intention in this scenario was to try to create a Page that would display in full (without a teaser) on the front page.
(I am a newbie and have no idea if I chose the correct Component.)
Comment | File | Size | Author |
---|---|---|---|
#19 | drupal.text-empty.19.patch | 924 bytes | sun |
#12 | summary_empty_body_js_test2.patch | 3.11 KB | ygerasimov |
#10 | summary_empty_body_js_test.patch | 3.13 KB | ygerasimov |
#9 | summary_empty_body_js.patch | 1.4 KB | ygerasimov |
#7 | summary_empty_body.patch | 870 bytes | ygerasimov |
Comments
Comment #1
pshahmumbai CreditAttribution: pshahmumbai commentedBug is confirmed.
When you remove the content from the full text area, the row data is also getting deleted from the database table 'field_data_body'
Update :
./modules/node/node.module:function node_save($node) : If the full text is not present then the $node does not contain any value for $node->body
["body"]=> array(1) { ["zxx"]=> array(0) { } }
The correct values should be :
["body"]=> array(1) { ["zxx"]=> array(1) { [0]=> array(4) { ["summary"]=> string(22) "This is a sample text" ["value"]=> string(0) "" ["format"]=> string(1) "1" ["value_format"]=> string(1) "1" } } }
It considers it as the same situation as both the body summary and full text field being empty.
Comment #2
aspilicious CreditAttribution: aspilicious commentedConfirmed
Comment #3
furamag CreditAttribution: furamag commentedI think I found where problem is. Function text_field_is_empty (modules/field/modules/text/text.module) return TRUE if body field is empty even if summary is not empty. After that function _field_filter_items (modules/field/field.module) unset body field (and summary field too).
Current code for text_field_is_empty function is:
We should use following code:
Also I found patch for this function - http://drupal.org/files/issues/body-as-field.patch . But this patch failed test (http://qa.drupal.org/pifr/test/5791) so we can't use this patch. Instead of that we can create another patch:
Comment #4
dhalbert CreditAttribution: dhalbert commentedChanged issue title to match terminology in current 7.x: "Full text" is now "Body". Bug is still present.
Brief repeat of scenario with current terminology:
1. Create a new Article or Basic Page with some text in the Summary and no text in the Body.
2. Save it. When you look at it again, there will be nothing in both the Summary and Body
Comment #5
ygerasimov CreditAttribution: ygerasimov commentedHere is patch for #3. But there is another problem that is raised after applying it. When you Edit the node with Summary only, summary field collapsed. Also I believe we need to make test for this case (empty body and not empty summary).
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedThere is a slight indenting issue here.
Comment #7
ygerasimov CreditAttribution: ygerasimov commentedYes. Identing issue fixed.
Comment #8
yched CreditAttribution: yched commented[edited out, I was on crack]
Comment #9
ygerasimov CreditAttribution: ygerasimov commentedHere is patch including fix for javascript. Please review.
Comment #10
ygerasimov CreditAttribution: ygerasimov commentedHere is patch with test.
Comment #11
yched CreditAttribution: yched commentedSorry ?
white line should have no spaces
Other than that, patch looks good.
Powered by Dreditor.
Comment #12
ygerasimov CreditAttribution: ygerasimov commentedThank you for the review. I have cleaned the patch.
Comment #13
dhalbert CreditAttribution: dhalbert commentedPatch tested and works as expected, both when creating new content and editing existing content. Thank you!
Displayed on its own page, the item appears empty.
Displayed on the front page, the summary is shown, with a "Read more." Still a bit pathological, but now there is no chance of losing the summary if one clears the body.
Comment #14
yched CreditAttribution: yched commentedfine, thanks !
Comment #15
webchickCommitted to HEAD. Thanks!
Comment #16
sunErm. This entire condition construct looks very odd.
The initial condition likely meant
isset($item['value']) && $item['value'] === ''
Same for the condition that has been introduced.
Powered by Dreditor.
Comment #17
yched CreditAttribution: yched commentedThis also catches $item['value'] === NULL, or $item === array()
I'd leave it that way.
Comment #18
sunAlright, so we actually mean:
Comment #19
sunComment #20
dhalbert CreditAttribution: dhalbert commenteddrupal.text-empty.19.patch tested. OK - works same as previous one.
Comment #21
yched CreditAttribution: yched commentedSure.
Comment #22
webchickCommitted to HEAD. Thanks!