Customizing Node edit form
Hi Everybody,
I am a newbie in the drupal module development world. My requirement is that i want to hide all the details like 'Publishing options', 'menusettings', 'authoring information' etc while the user is creating my node type. I have achieved that by creating my own node creation form and using node_save in its submit callback function.
But now the problem is with the node editing form (node/xx/edit). Drupal again defaults to its node creation form when i click the edit button. It displays all the above said information in that. How to tell drupal to display my form in the edit option too?? and how to add a preview option to my form??
Please help me with this.. I searched a lot but was not able to find an answer to this...

Try this
Hi manujoseph,
read this post: http://drupal.org/node/101092
I think you are looking for a solution like this.
mileZ
Seo Web
Found a non-elegant solution
Hi mileZ,
Thanks for your help.. That post was a very good way of achieving what i wanted.. Thanks a lot for that.. But i found that a lil too complex to implement.. I found another slightly non-elegant way of doing it.. I decided to use hook_form_alter.. I am adding the code below
/**
* Implementation of hook_form_alter()
* This hook is used to alter the domain form before rendering so that
* unwanted details are hidden from the user
*/
function domain_form_alter($form_id,&$form) {
if( $form_id == "domain_node_form" ) {
// the following hides the unwanted details from the user
// so that the user has to fill only the necessary details
$form['author']['#type'] = 'hidden';
$form['options']['#type'] = 'hidden';
$form['comment_settings']['#type'] = 'hidden';
$form['menu']['#type'] = 'hidden';
$form['path']['#type'] = 'hidden';
// $form['form_info'] = array(
// '#value' => '<pre>'. print_r($form, TRUE) .'</pre>'
// );
}
}
Any mistakes here or any ways of improving it??
hidden form elements -- not working for me
Hi,
I am using hidden form elements as described above. They are working fine, with one big exception. When I set
$form['options']['#type'] = 'hidden'the node shows up as "not published", even though the default "published" value is TRUE:
[options] => Array(
[#type] => fieldset
[#access] => 1
[#title] => Publishing options
[#collapsible] => 1
[#collapsed] => 1
[#weight] => 25
[status] => Array
(
[#type] => checkbox
[#title] => Published
[#default_value] => 1
)
...
Any ideas what might be wrong?
Thank you.