1

In Drupal 6, there was a method to theme the edit form for nodes of a custom type:

 /**
* Implements hook_theme().
*/
function hook_theme($existing, $type, $theme, $path) {
    return array(
   'node-type_node_form' => array(
   'variables' => array(
   'form' => NULL,
     ),
   'template' => 'node_type-node-form',
   ),
 );
}

Drupal 7 handles this method with the following template files: page--node--add--contenttype.tpl.php, or, page--node--edit--contenttype.tpl.php.

I didn't find any documentation about how I should render form items in these templates. $form is null.

Which variable should I use to render the edit form for my content type?

1 Answer 1

4

Can you try this code in page--node--add--yourcontenttype.tpl.php

module_load_include('inc', 'node', 'node.pages');

$form = node_add('your node type');

print drupal_render($form);

Refer Change aspect of node add form (not only via css)

Your Answer

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

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