You are here

12 June 2011

How to use hook_form_alter for altering node forms.

Source code viewer
  1. /**
  2.  * Implements hook_form_alter().
  3.  */
  4. // Replace HOOK with your module name, lower case and underscores instead of spaces.
  5. function HOOK_form_alter(&$form, &$form_state, $form_id) {
  6. // Replace node_machine_name with node machine name.
  7. if ($form_id == 'node_machine_name_node_form') {
  8. // Complete array structure of your content type form.
  9. print_r($form);
  10. // or use devel module pretty print.
  11. dpm($form);
  12. }
  13. }
Programming Language: PHP