Trying to theme my own node add form with hook_theme() in my own module. In the *.tpl.php page for the node add form, submit button is not actually adding the content to database.

Issue: Why is "php print render($buttons);" not adding the right submit handler that actually adds a node (Content) entry.

In my stories.module file:

 /* Implements hook_theme().
function stories_theme($existing, $type, $theme, $path){
  return array(
    'stories_node_form' => array(
      'render element' => 'form',
      'template' => 'stories-node-form',
      'path' => drupal_get_path('module', 'stories'),

function template_preprocess_stories_node_form(&$variables){

    $variables['sidebar'] = array();   // Put taxonomy fields in sidebar.

    $variables['sidebar'][] = $variables['form']['field_tags'];

    // Extract the form buttons, and put them in independent variable.
    $variables['buttons'] = $variables['form']['actions'];

In stories-node-form.tpl.php:

    <div id="stories-add-wrapper">
<div class="nicname_and_category">
    <?php //print drupal_render_children($form); ?>
    <div class="input_auteur">
        <?php print render($form['field_nicname']); ?>

    <div class="input_cat">
        <?php print render($form['field_email']); ?>

<div class="title_and_category">
    <div class="title">
        <?php print render($form['title']); ?>

    <div class="category">
        <?php print render($form['field_category']);  ?>

<?php print render($form['field_share_your_story']);        ?>

<?php print render($buttons); ?>
  • Found the solution. Needed to add the following to the end of stories-node-form.tpl.php <?php print drupal_render_children($form); ?>
    – drupalmav
    Nov 21, 2012 at 9:20

1 Answer 1


Found the solution. Needed to add print drupal_render_children($form); to the end of stories-node-form.tpl.php

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.