drupal form alter

drupal

Solution

In addition, the node add/edit forms have content-type specific IDs. so story nodes would be:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'story_node_form') {    
    drupal_set_message(t('Editing a story node!'));
  }  
}

If you're looking to catch every node edit form, regardless of type, try this:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['#node']) && $form_id == $form['#node']->type .'_node_form') {
    drupal_set_message(t('Editing a node!'));
  }  
}

Problem

I'm developing a module which alter display of add/edit node forms. I'm a beginner in module development. I have written following code, it is not working properly. Please tell me what's wrong with this? ``` function hook_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'node_form') { drupal_set_message(t('some message.')); } } ``` This is for drupal 6.

Original source