Posted by Onein on February 2, 2012 at 3:13pm
2 followers
Jump to:
| Project: | Zen |
| Version: | 6.x-2.0 |
| Component: | PHP code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
In order to theme a node creation/edit form, one might typically create form-mynode.tpl.php and then add the following to template.php:
<?php
function mytheme_theme(){
return array(
'mynode_form' => array(
'arguments' => array('form' => NULL),
'template' => 'form-mynode',
),
);
}
?>However, a Zen subtheme already has a mytheme_theme function:
<?php
/**
* Implementation of HOOK_theme().
*/
function mytheme_theme(&$existing, $type, $theme, $path) {
$hooks = zen_theme($existing, $type, $theme, $path);
// Add your theme hooks like this:
/*
$hooks['hook_name_here'] = array( // Details go here );
*/
// @TODO: Needs detailed comments. Patches welcome!
return $hooks;
}
?>How should the code at the top be incorporate into this mytheme_theme function?
Comments
#1
Hi,
I think I've managed to specify a new template file as follows. However, the new template file needs to live in the themes root, /sites/all/theme/your_theme/ instead of /sites/all/theme/your_theme/templates/node/ or /sites/all/theme/your_theme/templates/form.
function my_theme(&$existing, $type, $theme, $path) {
$hooks = zen_theme($existing, $type, $theme, $path);
// Add your theme hooks like this:
/*
$hooks['hook_name_here'] = array( // Details go here );
*/
// @TODO: Needs detailed comments. Patches welcome!
// Declare new template file for a node form
$hooks['mynode_form'] = array(
'arguments' => array('form' => NULL),
'template' => 'form-mynode'
);
return $hooks;
}
Jason