[documentation] [task] Update hook_* documentation for 4.7

drewish drupal-docs at drupal.org
Sun Dec 11 08:44:39 UTC 2005


Issue status update for 
http://drupal.org/node/37019
Post a follow up: 
http://drupal.org/project/comments/add/37019

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     tasks
 Priority:     normal
 Assigned to:  drewish
 Reported by:  drewish
 Updated by:   drewish
 Status:       patch (code needs work)

Add: form_alter
hook_form_alter($form_id, &$form_values)


Possible values for $op in hook_nodeapi()
These are what I've found greping through node.module (I've grouped
them in what appeared to be a logical order to me):
'prepare', 'validate', 
'load'
'view'
Corresponding to the node operations:
'insert', 'update', 'delete'
Render this an an RSS feed
'rss item'
Search related
'update index'
'search result'
Content type settings
'settings'


Node Hooks (need to verify these)
1. prepare
2. form (return an array)
3. validate (you can only validate here, no changes possible)
4. execute (prepare the node for save)
5. insert/update




drewish



Previous comments:
------------------------------------------------------------------------

Wed, 09 Nov 2005 20:23:19 +0000 : drewish

The following functions need documentation:
hook_form_alter()
hook_form_validate_alter()
hook_form_execute_alter()


Additionally, I've noticed that the following hook documentation needs
to be updated to use the new Forms API for 4.7:
hook_block()
hook_settings()
hook_user()


This isn't meant to be a complete list, just a starting point. Please
add any other hooks you may find.




------------------------------------------------------------------------

Wed, 09 Nov 2005 20:28:41 +0000 : chx

hook_nodeapi op validate changed, prepare and execute are new. there are
similar hooks I suppose.




------------------------------------------------------------------------

Wed, 09 Nov 2005 20:49:37 +0000 : drewish

*Parameters for form hooks*
I'm assuming that the values all have to be by reference...
hook_form_alter($form_id, &$form_values)
hook_form_validate_alter($form_id, &$form_values)
hook_form_execute_alter($form_id, &$form_values)


*Possible values for $op in hook_nodeapi()*
These are what I've found greping through node.module (I've grouped
them in what appeared to be a logical order to me):
'load', 'insert', 'update', 'delete',
'view', 'rss item',
'prepare', 'validate', 'form',
'update index', 'search result',
'settings', 


Can someone confirm this?




------------------------------------------------------------------------

Fri, 11 Nov 2005 09:22:10 +0000 : drewish

Attachment: http://drupal.org/files/issues/hooks_docs.patch (4.26 KB)

Here's a basic patch that adds prototypes for the new hooks and converts
some of the form api code.




------------------------------------------------------------------------

Wed, 23 Nov 2005 18:23:41 +0000 : drewish

Looks like most of the _alter hooks are going to be removed...
http://drupal.org/node/38349






More information about the documentation mailing list