I have a content type 'project' and I want to theme the node add form for this content type, I tried to create a page--node--add-project.tpl.php but I don't have the list of form element to render in this file. devel_themer don't print the variables list in the node add page thanks
2 Answers
You can use following code in your template.php
/**
* Implements hook_theme().
*/
function mytheme_theme($existing, $type, $theme, $path) {
return array(
'project_node_form' => array(
'render element' => 'form',
'template' => 'project-node-form',
// this will set to module/theme path by default:
'path' => drupal_get_path('theme', 'mytheme') . '/templates',
),
);
}
Place project-node-form.tpl.php in your themes templates directory.
On the page level forms are rendered and so you cannot get its elements. You will need to implement a hook_theme function in template.php file where you define the path of the template file and also implement preprocess function if required.
You can see a detailed explaination here .. Theming Forms with Template file