Hello, I’d like to run a script when a specific page type is updated. The script I need to run requires calling a PHP library (via require), etc. It’s does a bunch of stuff. Dumping this script into the config file seems sloppy and it doesn’t seem to like the require bit either. Should I house this script in a snippet or is there some other method that’s preferred? Please advise.
'hooks' => [
'page.update:after' => function($newPage, $oldPage){
if($newPage->intendedTemplate() == "mytemplate"):
// Do lots of stuff. Here though?
endif;
}
]