I'm using Drupal 6 with many modules. It often happens that I'm trying to track down which hooks are being invoked on a specific form, but up till now I've been making educated guesses. How can I figure out which hooks are being invoked on a node edit form (or other forms)?

  • 1
    Do you mean hooks in general on the page or all of the alters for just the form? – mpdonadio Jun 21 '13 at 2:21
  • And do you mean hooks on page creation only, or on save too? – Mołot Jun 21 '13 at 6:44
  • @MPD I'm looking for all the alters for just the form. – Rustavore Jun 21 '13 at 19:26
  • @Mołot I'd like to see both hooks when the edit form is sent to the browser initially (prior to save time) – Rustavore Jun 21 '13 at 19:27

hooks are basically functions provided by drupal to developer , so as to create a communicating medium between developer and drupal. hooks get called or render on a page when particular action associated with them take place it is more like drupal send a message to hook "describing what action drupal is doing " and hook ask developer "drupal is doing this do you want to add more stuffs or to perform any action on this action of drupal"

so depending on action taking place hooks are invoked

  • well explanation @prateek ojha!!! – Deepak Kumar Jun 21 '13 at 7:41
  • How does this answer which hooks get called for the node edit form? – mpdonadio Jun 21 '13 at 21:10
  • Thanks, prateek -- I do already understand what hooks are. I'm trying to figure out what hooks are being fired at a specific url: /node/123/edit. I'd like to debug some strange behavior on my node edit form. – Rustavore Jun 21 '13 at 21:32

If you have to do something on node edit page then use hook_form_alter.But remember to check $form_id while coding. And if you need any thing on node_update, then use this hook.(hook_nodeapi).But code this like:-

function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {    
    case 'update':
      //Here your code goes...
  • How does this answer which hooks get called for the node edit form? – mpdonadio Jun 21 '13 at 21:10
  • @MPD Read the answer properly..... I already wrote hook_form_alter for this – Deepak Kumar Jun 24 '13 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.