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>