Process node content (eg CCK, filter tags)
Oliver Coleman - March 9, 2009 - 03:03
| Project: | InsertNode |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
Attached is a patch that makes InsertNode apply the normal Drupal processing to the body of the node, so that things like CCK fields and filter tags will be included/processed. Note: this may/will break pages where a node inserts it's own body. It should be pretty easy to prevent this, but I think anyone inserting the same node in itself deserves to have broken pages. ;) Well, not really, but I don't have time to fiddle around with it.
| Attachment | Size |
|---|---|
| InsertNode.module.process_content.diff | 1 KB |

#1
Actually, this may/will break all pages that are part of a cycle of node insertions (eg, let A, B and C be nodes. If A inserts B, B inserts C, and C inserts A, then A, B and C will break).
#2
Oliver,
Indeed, loops will break. Note that in the following, the last test on the 2nd line will always fail (i.e. return false).
<?php+ if ($matches[2] == 'body' || $matches[2] == 'collapsed')
+ $node = node_build_content($node, $matches[2] == 'teaser');
?>
I'm testing so see whether that fix would work in 6.x... 8-)
Thank you.
Alexis
#3
You're right, the last test on the second line will always fail; it was a vestige of previous development, like that crazy appendix in humans... :)
#4
Oliver,
Okay! I have found the proper function to use in Drupal 6.x. It is called node_view().
<?phpnode_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE);
?>
That can be used to display the body, the teaser and the links.
I'm about to include that in the D6 version (btw, I do not support the v5.x so I will not be applying your patches, however, feel free to contact the primary author to be included as a programmer if you want to do so! It would be great, there are several other issues in v5.x that need to be fixed... 8-) )
EDIT:
This is now checked in the -dev version. It works great for me and includes an anti-recursivity feature too.
Thank you.
Alexis