[development] changes to hook_nodeapi

adrian rossouw adrian at bryght.com
Thu Aug 31 20:16:31 UTC 2006


On 31 Aug 2006, at 10:01 PM, Jeff Eaton wrote:

>
> Perhaps what we should ask is, 'OTHER than rolling back an important
> piece of code recapturing, how can we make the new mechanism as  
> easy for
> developers as the old one was?' Not _the same as_ but _as easy as_.
> Perhaps a helper function to 'register' your module's CRUD without
> altering any form arrays? Perhaps node_save() existing as a wrapper
> function for the functionality?
I've mentioned this before, but hooks are also callbacks, you could  
make the node
form register them automatically.

ie:
if (function_exists($node->type . '_validate')) {
   $form['#validate][$node->type . '_validate'] = array();
}
foreach (module_implements('nodeapi') as $module) {
   $form['#validate'][$module . '_nodeapi'] = array('validate');
}

that would remove all unneccesary form alters, but would require the  
function definition of node api to change.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060831/bea101f8/attachment.htm


More information about the development mailing list