Table of Contents

API Sequences: node life cycle

(in Drupal 4.6.x)

… during the building of the various pages creating and editing a custom node…, as noted on a 4.6.3 installation during the development of the helpdesk module

Table of hook calls seen by a module

Sequence of hooks fired 1: New 2: Preview 3: Submit
invalid new
4: Submit
valid new
5: Redirect
after create
6: View node 7: Edit node 8: Track node
hook_menu X X X X X X X X
hook_access         1 per node type      
hook_node_types X              
hook_user('load') no uid
name
no uid
name
no uid
name
no uid
name
       
hook_load         valid nid valid nid valid nid valid nid
hook_nodeapi ('load')         valid nid valid nid valid nid valid nid
hook_menu         X      
hook_user('load')             no uid
name of node owner
 
hook_validate builtin fields builtin fields
module fields
no object
builtin fields
module fields
no object
builtin fields
module fields
no object
    builtin fields

loaded object
 
hook_nodeapi('validate' X X X X     valid nid  
hook_nodeapi('fields')       X        
hook_insert       builtin fields
module fields
no object
valid nid
       
hook_nodeapi('insert')       valid nid        
hook_user('load')   no uid
name
no uid
name
         
hook_view   builtin fields
module fields
no object
builtin fields

loaded object
  valid nid valid nid    
hook_nodeapi('view')     X   valid nid valid nid    
hook_nodeapi('form pre') X X X       valid nid  
hook_form builtin fields builtin fields
module fields
no object
builtin fields
module fields
no object
      builtin fields

loaded object
 
hook_nodeapi('form post') X X X       valid nid  
hook_nodeapi('form admin') X X X       valid nid  
hook_nodeapi('form param') X X X       valid nid  
hook_node_name X X X valid nid        
hook_node_types X   X X X X X X
hook_block 1 per block 1 per block 1 per block 1 per block 1 per block 1 per block 1 per block 1 per block
hook_help('node/...') add/<node type> add/<node type> add/<node type> add/<node type> <nid> <nid> <nid>/edit <nid>/track

Notes

The difference between 'modules fields' and 'loaded object' occurs if the module defines the additional fields it handles as fields as wrapped in an object elswehere

Basically, modules fields are returned from a HTML form, whereas a loaded object comes from the DB.

Of course, any additional calls done by the module will appear somewhere in between these. For instance, helpdesk loads the information about a contract's customer, which is a drupal USER, so

hook_user('load')

is fired from the module.

Similarly, any call to l() causes hook_link to be fired too.