Archive for November 2007
Magic Code
Posted on: November 6, 2007
- In: Uncategorized
- Leave a Comment
I am sure , if you are developing a module in Drupal, then sometimes you might have needed to remove the ‘preview’ button from the new entry form. May be you want to remove the preview option for comment posts. Then here is a simply useful code.
In your module file add these lines of code,
function mymodulename_form_alter($form_id, &$form) {
// echo("form_id".$form_id); This line is just to check your form id.
if(($form_id=="mycontenttype_node_form")||($form_id=="comment_form")) {
unset ($form['preview']);
}
}
I got this help from http://drupal.org/node/138393
Tags: Bugs & Tricks

Recent Comments