API page: http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...

Describe the problem you have found:

The return values is documented as:

An structured array containing the individual elements of the node's body.

But the code disagrees:

<?php
$node
->body = isset($node->body) ? str_replace('<!--break-->', '', $node->body) : '';
//...
return $node;
?>

We're really returning a node withe the node's content property containing an array of structured data. See hook_view() for more details.

Files: 
CommentFileSizeAuthor
#9 node_build_content-1095066-9.patch603 bytesbarbi
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#7 node_build_content-1095066-7.patch602 bytesbarbi
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#3 node_build_content-1095066.patch507 bytesbarbi
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Comments

Title:Documentation problem with node_build_contentnode_build_content return value doc is wrong

That is true, and it should be fixed. This is a Drupal 6 problem only -- in D7 the function doesn't return anything (it modifies $node in place).

Agreed with the "Novice" tag. Should be a good project for a novice doc contributor.

Assigned:Unassigned» barbi

Priority:Normal» Critical
Status:Active» Needs review
StatusFileSize
new507 bytes
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Changed return to "A fully-populated node object."

Priority:Critical» Normal
Status:Needs review» Reviewed & tested by the community

node_load does the same see

* @return
*   A fully-populated node object.
*/
function node_load($param = array(), $revision = NULL, $reset = NULL) {

so the patch is fine.

Congratulations on your first patch.

@barbi: Critical means that something is really really broken. For example a white screen of death.
Set back to normal again.

Status:Reviewed & tested by the community» Needs work

Well, node_build_content() is only one of the functions that is being used to build up the "fully-populated node object", so I'd not say it builds a fully populated node object. Yes, that is what node_load() does. We should be more specific here and say what it builds.

Follow up:
Can you please suggest a good description?

Status:Needs work» Needs review
StatusFileSize
new602 bytes
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Modified the description to
* An node object with its content property set to structured array
* containing the individual elements of the node's body.

Status:Needs review» Needs work

An node -> A node
set to structured array -> set to a structured array

Other than that, excellent...

Status:Needs work» Needs review
StatusFileSize
new603 bytes
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Sorry for the multiple iterations. Made the two corrections mentioned in #8.

Status:Needs review» Reviewed & tested by the community

That looks good to me. And don't worry about multiple iterations -- most issues in Drupal core go through many. This is nothing. :)

Status:Reviewed & tested by the community» Fixed

Thanks for the improvements, committed.

Status:Fixed» Closed (fixed)
Issue tags:-Novice

Automatically closed -- issue fixed for 2 weeks with no activity.