Which node hook API shall I use? (Drupal 7)

73 Views Asked by At

I am working on a Drupal 6 to 7 site migration project. Many pages contain a custom token in [node-NID] format. The function of this custom token is to retrieve a node (identified by NID) body text.

After migration to Drupal 7, the custom function cannot work and I have no plan to write it because I find Advanced Entity Tokens can do a much better job.

So I want to keep [node-NID] in database, but whenever a node is loaded, I want to parse the loaded text to see if it contains an expression in [node-NID] format. If it does, then replace it with [aet:node:NID:body], which is custom token format that Advanced Entity Tokens offer. I will leave it to Advanced Entity Tokens to do the remaining work (replace token value)

Which node API hook shall I use?

  • hook_load? hook_node_load?
  • hook_view? hook_node_view?
1

There are 1 best solutions below

0
On

I found a better solution: use Custom Filter module