Node_View w/ Webform

Events happening in the community are now at Drupal community events on www.drupal.org.
kelvinleehk's picture

Has anyone encountered problem using node_view to embed a webform in a node in D7?

I used to be able to use the following code to embed a webform node in another node with no problem back in D6:

<?php
$form_nid
= 5;
$form_node = node_load($form_nid);
print
node_view($form_node);
?>

In my D7 installation, it returns just the word "Array" for some reason. I have tried enable the said form in block and embed it in a node too with no avail:

<?php
$block
= module_invoke('webform', 'block_view', 'client-block-5');
print
$block['content'];
?>

It too returns the word "Array". Has anyone had this problem before? Is it D7 or just me?


Kelvin Lee
SourceSquare | Web Design • Drupal • SEO

Comments

In D7 node_view() (and most

dalin's picture

In D7 node_view() (and most functions that used to output HTML) now return a renderable array
http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...
should just require
print drupal_render(node_view($node));

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

That's embarrasing... Thanks

kelvinleehk's picture

That's embarrasing...

Thanks for the tips,Dave. You are making everything look so easy lol.

DrupalHK

Group categories

HKDUG Vocabulary

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: