Hi, Bèr Kessels wrote:
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.
This would work to a certain extent, but then there is the user interface. The system is going to be telling the user that they can filter on these different things that are just not going to work on an object that is not a node. The global filters will be fine (in that they don't care what the object is) but the filters that require a node are going to publish in the filter tips that are not going to be done. Which would be confusing for the user. I know my implementation is a little more complex, but it does add context sensitivity to the mix and be better for the user, and not so ambiguous for the developer. Gordon.