Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
node.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Oct 2008 at 23:58 UTC
Updated:
2 Jan 2014 at 23:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
webmasterkai commentedAny word on this?
Comment #2
qutoz commentedHi,
After making some researches and diving inside Drupal code, I got some ideas about what is happening there:
1- admin/content/node-type/page : clear the "Body field label" and save
2- node/add/page : "Input format" fieldset removed automatically, because it has nothing to do in case of "Body" field not there.
3- "Input format" fieldset contains 2 radio buttons (the name of radio group is "format").
4- When you click "Preview", actually the form is submitted, so the form values should be stored inside
$form_state['values']variable as array.5-
$formand$form_statevariables are passed tonode_form_build_previewfunction (in node.pages.inc), which passes them tonode_form_submit_build_nodefunction to build$nodeobject, which passes them tonode_submitfunction (defined in node.module), at this point exactly$nodeobject is built and created with properties, according to those posted by the form, so it may or may not contain the "format" property.6- After that,
$nodeobject is passed to series of functions, till it reaches "node_view" function (in node.module), where the error is happening due to line 1037:where the
$node->formatdoes not exist.Note: This is not happening in case of viewing the content type after submission, because
$nodeobject is loaded with "format" property by default.Currently I have 3 suggestions
1- In case that there's no "Body field", Drupal should keep the "Input format" fieldset with its radio buttons.
2- Building
$nodeobject in a way that it always contains "format" property.3- Preventing the submission of content type without "Body field" :)
If anyone of these suggestions, or even any other suggestions, is OK, I want to make the patch myself, if it is OK with you guys :)
Comment #3
pasqualle1. no - I don't need a format when I do not need the body
2. yes
3. no - I need a content type without body
Comment #4
qutoz commentedHi,
Sorry for being late I just want to be sure that there are no new suggestions or comments.
Please take care that I added a new part in bold to my first comment.
So here is the patch and thanks for your patience.
Comment #5
swentel commentedCan confirm this, this is also present in D7, so changing version. Patch in #4 fixes D6 branch, attached in #5 is for drupal head.
Comment #6
qutoz commentedThanks swentel for your attention. :)
Comment #7
swentel commentedChasing HEAD
Comment #8
swentel commentedTagging & bumping.
Comment #9
damien tournoud commentedA new argument for my "put body and format in a same element".
Format is an integer, this should be
$node->format = 0;.Comment #10
swentel commentedComment #11
catchLooks good the input format changes will likely change how this works anyway (and with tests), so RTBC.
Comment #12
webchickCommitted, thanks!
Moving down to 6.x.
Comment #13
gábor hojtsyThanks, committed to Drupal 6 as well.