The onBeforePagesSaveFilter handler runs during the page save process in LiveWhale CMS after the page buffer has been validated to prevent all errors but before it completes the save process.
<?php
$_LW->REGISTERED_APPS['my_app']=[
'title'=>'My App',
'handlers'=>['onBeforePagesSaveFilter'],
];
class LiveWhaleApplicationMyApp {
public function onBeforePagesSaveFilter($buffer) {
global $_LW;
// Do whatever you want to $buffer here...
return $buffer;
}
}
?>
Note, the resulting $buffer will still get passed through LiveWhale’s internal page formatting tool, so certain markup changes you make might get reformatted or respelled after your handler is run.