This is one of those, "Looked everywhere in the API for a hook, can't find it" questions. There must be a hook like I'm looking for, but none of my searches have found anything.
I'm looking for a simple hook in D7 that lets me edit text filtered content, after it's gone through a text input filter, before it's saved: regardless of which input filter, and regardless of entity type (i.e. not just nodes).
I can't find a suitable hook. The new-style hook_filter()
alternative hook_filter_info()
isn't suitable because I want this code to run on all input filters, so I don't want to define a new one.
hook_node_save()
is too specific. I could maybe hook on both hook_entity_insert()
and hook_entity_update()
(to approximate a hook_entity_savehook_entity_presave()
), then load field info, then look through all fields looking for fields that are longtext fields, then act on those, but I'm hoping there's something more direct. That sounds like a lot of extra work for something simple. I'd prefer not to have every single entity save load all the field info and check every field (unless there's a very low-overheads way to do that).
What's the simplest, cleanest way to get code to run on all text that has gone through an input filter, regardless of the input filter?