1

I have a content type called “osago”. And I have a module that outputs some things.

How can I output the create this content type form within this module?

3 Answers 3

2

You will have to use drupal_render() on node_add() result.

module_load_include('inc', 'node', 'node.pages');
$content = node_add('osago');
print drupal_render($content);
0
<?php
  module_load_include('inc', 'node', 'node.pages');
  print node_add('osago');
?>

or

<?php
  module_load_include('inc', 'node', 'node.pages');
  $content=node_add('osago');
?>

etc etc (you may or may not need the module_load_include() depending on how you've set your module up, too)

2
  • node_add('osago') returns Array. How can I print it? Nov 30, 2011 at 9:23
  • and when I execute these two lines my main title is altered. Nov 30, 2011 at 9:41
0

drupal_set_message() or (dsm() if you have devel installed) is your friend...

<?php
  $content=node_add('osago');
  drupal_set_message('<pre>' . print_r($content,true) . '</pre>');
?>

...and in this case will print out in your theme's message area the structure of a variable, and from that you should be able to see what's going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.