Theme a CCK input form in Drupal 6
Question
In my template.php file I've this:
function myadmintheme_theme(&$existing, $type, $theme, $path) {
return array(
'node_form' => array(
'arguments' => array('form' => NULL),
'template' => 'ccktype',
),
);
}
And I've a ccktype.tpl.php in the same dir:
<b>works!</b>
But is not working, if I enter to node/add/ccktype I don't get the "works!" message.. I tried everything!
any help would be appreciated
Solution
The theme function you need to override is ccktype_node_form, not node_form. All node forms maintained by the node module get mapped to the node_form function for building, but they still have unique form ids.
OTHER TIPS
This is the solution:
function myadmintheme_theme($existing, $type, $theme, $path) {
return array(
'ccktype_node_form' => array(
'arguments' => array('form' => NULL),
'template' => 'ccktype',
),
);
}
thanks a lot Eaton!
It started to work for me but after a loong set of trials. :)
I'm using Drupal 6 & I made the mistake of writing code for Drupal 5. I used form_render
(wich is meant for D5) instead of drupal_render
(for D6), in my node-minister-edit.php.
And the next change in template.php was function
waffles_theme($existing, $type, $theme, $path){
return array( 'minister_node_form' => array( 'arguments' => array('form' => NULL), 'template' => 'node-minister-edit' ) );
}
See the array argument template
is changed from minister
to node-minister-edit
which is my node specific template file. Here in minister_node_form
, the first word 'minister' is my content type.
And as Seb said I cleared the caches before I started to use any such change. Hope this helps others :)
The following items have helped me out:
1. http://drupal.org/node/601646
2. http://drupal.org/node/98253
First of all, see that Drupal's not caching your module. Go to Administer > Site Configuration > Performance, and clear all caches.
If that doesn't work, try renaming the file to node-add-ccktype.tpl.php.