Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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'];
    hide($variables['form']['field_tags']);

    // Extract the form buttons, and put them in independent variable.
    $variables['buttons'] = $variables['form']['actions'];
    //hide($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>  

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

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

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

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

<?php print render($buttons); ?>
    </div>
share|improve this question
    
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 '12 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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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