Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By OptimusPrime23 on
hi,
i am using drupal 6,i would like to know whether there is any way to customize the node's add form in drupal6.
I know that page-node-add-[contenttype].tpl.php is the template to be taken but whats the way of getting the form elements in that.
previously in drupal 5 we used to get the form elements in the $form array. but in drupal6 its not available.
I could not figure out how to customize the node/add node/edit using that approach. Do anyone have a solution?
Comments
Hi there - There are a couple
Hi there - There are a couple ways to customize your Drupal forms. I have an example of how to customize the user login block by adding a form override in your template.php file -- you can use the same concept to make changes to your node edit form.
You can take it a step further and make a full-on tpl file for your node edit form: Here's an example of Theming the User Registration Form. (Please be sure to read the comments on that one because the tutorial leaves out some crucial information.)
Both of these examples can be adapted to your needs - let me know if you need further help doing that.
Thanks,
Amanda
Atlast I found the solution for Node's add form for drupal 6
At last I fixed the issue...
The steps that i followed are :
1. Edit template.php
Add the following
2. Create content_type_add.tpl.php
Add the following
the $form variable would contain all the necessary for values
3. "Clearing Cache Data before viewing the result" VERY IMPORTANT
All i was lacking was "Clearing Cache Data before viewing the result".
So anyone who is customizing the node's add form in Drupal 6 pls make sure to clear the cache.
Try this n explore drupal.have fun
Cheers,
Ninu Ann
Thanks
It worked. made my task easier.
cheers!
I don't know if it's just me
I don't know if it's just me but the above approach not working in drupal 7. I do the exactly thing and replace "yourthemename" in yourthemename_theme with my theme name and "contenttype1_node_form" with "testing_content_type_node_form". Is there anything else I need to change to make it work?
Thanks!
I tryed do everything written
I tryed do everything written in post by ninu_ann, but in Drupal 7 this not work. Anybody know how to customize add/edit node form for custom content type in Drupal 7?
@lidiia.litovko any luck so
@lidiia.litovko any luck so far?
I found this and it worked in Drupal 7
As per this example:
http://alvinalexander.com/drupal/drupal-modify-page-node-title-custom-ne...
I added this to the theme template.php. Set the theme name and replace "charity" with the name of your content type.
/**
* Implementation of hook_form_alter().
* Modify the node title for my New Charity form.
*/
function YOURTHEMENAME_form_charity_node_form_alter(&$form, &$form_state) {
drupal_set_title('Suggest a Charity');
}
Same Problem
Been wondering how to go about it.
Web Design
There's a hook_theme_suggestion for page template
I'm using Drupal 7.24 and when I looked at the theme_hook_suggestions array for the page (page.tpl.php), I found that page__node__add__MYCONTENTTYPE was in the list. The same can be said for the html template suggestion.