[documentation] [bug] Node_example.module (4.7) doesn't use a
correct _view() order
drewish
drupal-docs at drupal.org
Mon Dec 12 20:43:31 UTC 2005
Issue status update for
http://drupal.org/node/40891
Post a follow up:
http://drupal.org/project/comments/add/40891
Project: Documentation
Version: <none>
Component: Developer Guide
Category: bug reports
Priority: critical
Assigned to: Anonymous
Reported by: fax8
Updated by: drewish
-Status: active
+Status: fixed
Commited to CVS.
drewish
Previous comments:
------------------------------------------------------------------------
Mon, 12 Dec 2005 17:34:56 +0000 : fax8
The current implementation of hook_view in node_example.module
doesn't use a correct order of instruction.
Doing node_prepare as last instruction will strip out every html tags
added by theme_node_example_order_info()
Simply change this
<?php
function node_example_view(&$node, $teaser = FALSE, $page = FALSE) {
$order_info = theme('node_example_order_info', $node);
$node->body .= $order_info;
$node->teaser .= $order_info;
$node = node_prepare($node, $teaser);
}
?>
into:
<?php
function node_example_view(&$node, $teaser = FALSE, $page = FALSE) {
$node = node_prepare($node, $teaser);
$order_info = theme('node_example_order_info', $node);
$node->body .= $order_info;
$node->teaser .= $order_info;
}
?>
should fix this.
Fabio
------------------------------------------------------------------------
Mon, 12 Dec 2005 18:37:12 +0000 : drewish
I think you're correct that te example is wrong but after looking at the
code in node_view(), it looks like node_prepare() is only called if you
don't implement a hook_view():
if (node_hook($node, 'view')) {
node_invoke($node, 'view', $teaser, $page);
}
else {
$node = node_prepare($node, $teaser);
}
------------------------------------------------------------------------
Mon, 12 Dec 2005 18:55:05 +0000 : drewish
Sorry, submitted too soon. What I meant to say was, I searched through
the core modules and the only time it really seemd like it was being
used was when a hook_view had been implemented to adjust the breadcrumb
trail.
After a little more reflection, I think your change is probably the
right one.
More information about the documentation
mailing list