[development] access to $node in hook_fillter()

Bèr Kessels ber at webschuur.com
Sun Jul 16 12:38:40 UTC 2006


Op zondag 16 juli 2006 14:20, schreef Gordon Heydon:
> One thing that I would like to see is targeted filters so that you can
> have a filter which will only be applied to nodes, and other filters
> which will be applied to other types of data which is being filtered.

I think it needs not be this complex. 
instead of 
 function hook_filter($op, $delta = 0, $format = -1, $text = '') {
 }
we need 
 function hook_filter($op,  $delta = 0, $format = -1, $text = '',  $object = 
NULL) {
 }

Where $object is either the $comment, $node, $term, $user or any other object. 
Or nothing at all (in case of just a piece of text).

This is by far the simplest solution I see. 

It does require a bit of logic on your side, when implementing the hook, but 
it cannot be that hard to test, e.g. for $node->nid (if exists, you are 
filtering a node).

Am I missing something obvious why this cannot work? If not, I will gladly 
turn this into a patch.

Bèr
-- 
 [ Bèr Kessels | Drupal services www.webschuur.com ]
Written while listening to Slowmotion Girl by Laid Back on Keep Smiling
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20060716/cfb777f5/attachment.pgp


More information about the development mailing list