[documentation] [bug] $op = "prepare" not listed on hook_nodeapi docs

dman drupal-docs at drupal.org
Sat Feb 25 04:02:43 UTC 2006


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

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  fax8
 Updated by:   dman
 Status:       active

Just some notes (maybe off-topic)
Currently the 4.7 node.module node_form() function does NOT trigger a
modules hook_nodeapi($op='form'...) like it used to with $op='form
pre'.


node_validate() for example, passes on to
node_invoke_nodeapi($node, 'validate');
... which is to say, it allows any modules to validate the node.


Likewise, most of the $ops normally sprung by hook_node_api() [1]
"prepare", "validate", "submit", "load" and "view" do anyway. But NOT
"form".


I believe this is because of the new form_alter() [2] method. I take it
modules are supposed to use that to do things they used to do in
hook_nodeapi($op='form pre') etc. 


... but modifying fields there still doesn't reflect the changes on
preview. ... still hunting through the code.
[1] http://drupaldocs.org/api/head/function/hook_nodeapi
[2] http://drupaldocs.org/api/head/function/hook_form_alter




dman



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

Wed, 01 Feb 2006 23:47:24 +0000 : fax8

Please add documentation about hook_prepare called
with $op = 'prepare'


Thanks,
Fabio




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

Sat, 25 Feb 2006 02:23:05 +0000 : dman

Seconded!
I found it mentioned over in the upgrade overview [3] and it seems that
as op=validate doesn't take modifications anymore that "prepare" must be
where I'm supposed to do that. ... but it doesn't.
The HEAD docs [4] still have the old version. (this is why I hate
putting docs in different places than the code, although I know it's
neccessary sometimes)


node.module has

<?php
/**
 * Apply filters to a node in preparation for theming.
 */
function node_prepare($node, $teaser = FALSE) {
?>


... which is not what I'm looking for at all (I thought).


I'm updating htmltidy.module, and I used to be able to correct users
markup on-the-fly as they previewed it. (by validating *and fixing* the
HTML on 'validate')


Do I have to to that in op=form now (feels wrong) or what?


.dan.
[3] http://drupal.org/node/22218#node_hook_order
[4] http://drupaldocs.org/api/head/function/hook_nodeapi






More information about the documentation mailing list