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

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:

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

Comments

drewish’s picture

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);
  }
drewish’s picture

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.

drewish’s picture

Status: Active » Fixed

Commited to CVS.

Anonymous’s picture

Status: Fixed » Closed (fixed)