I have written a custom module where i need to sanitize (replace) filed value of a node being displayed [replacing filed value only while displaying it, and not its original content].
To accomplish this, I thought to implement hook_field ($op = 'sanitize') in my custom module but unfortunately it is not being called by drupal system. I verified it by placing drupal_set_message() at very first line of code withing hook_field(), but no luck. Again when one of module in my project (link-6.x) has hook_field() has been implemented and gets call from drupal system with no issues.
Can any one explain me, either this is a bug or I am missing someting?
Thank you.
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedTriaging.
hook_field() is only called for the module defining the field, so this seems by design.
Comment #2
xjmThe field API was added in Drupal 7. You want hook_nodeapi().
Comment #3
xjmWhoops, simultaneous responses. :)
Comment #4
ice5nake CreditAttribution: ice5nake commentedThe fact that hook_field() is only called for the module defining the field is not well documented.
I am having the same problem in the module that is defining the field. I am using Features to define the Content Type and the Fields but I am still not seeing a call to hook field. Although I am using 6.x-2.9.