I've followed what previously worked in Drupal 6 in creating a separate template file for node/add/custom_content_type.
I've go this in my template.php:
function mytheme_theme() {
return array(
'business_case_justification_node_form' => array(
'arguments' => array('form' => NULL),
'path' => drupal_get_path('theme', 'mytheme') . '/templates',
'template' => 'business-case-justification-node-form',
'render element' => NULL,
)
);
}
I then created my business-case-justification-node-form.tpl.php file.
All of that works... when trying to do a node/add on the content type, drupal shows the barebones tpl.php file I have identified above in the 'template' line.
However the 'form' variable is null... always...
If I put dpm( get_defined_vars() ); in the tpl.php file, I get a $variables array. within that array is an unnamed array $variables[''] which holds a variety of information like #node, the fields etc etc.
How do I render the form elements now? drupal_render fails miserably. I can't find any documentation on this anywhere.
help!
Comments
As far as I know, path
As far as I know, path templates are built-in Drupal 7, so just do this:
page--node--add--blog.tpl.php (for blog)
page--node--add--story.tpl.php (for story)
etc.
etc.
Refresh cache!
PS Page template suggestions go into mytheme_preprocess_page(&vars), like this:
Drupal 7 example:
Good luck!
i implemented
i implemented hook_preprocess_page():
then created file: page--node--add--article.tpl.php from page.tpl.php
and edit page--node--add--article.tpl.php few rows. but page is not changed
First off your code is a
First off your code is a little messed up you are using $variables as the receiving var and then using $vars as the processing var... Once you fix that it should work.
Try with 'render element' => 'form',
Raphael
That does the trick
adding the 'form' to the render element seems to have done the trick so far.
www.nextide.ca