Thank you guys. In the meantime I found another solution which suits my need:
public function init() {
$this->addHookAfter('Pages::saveReady', $this, 'afterSaveReady');
}
public function afterSaveReady($event) {
// Get the soon to be saved page object from the given event
$page = $event->arguments[0];
// Sample condition and changes
if($page->template == "nepremicnine-vnos" && !$page->isTrash()){
//Price
$cena = $page->cena;
//Old price
$stara = $page->cenaStara;
$znizano = $page->znizano;
//Checkbox to display old price, if not checked on save copy price to oldPrice
if($znizano == 0) {
$page->set("cenaStara", $cena);
$page->save("cenaStara");
}
}
}
}
I will look into the way of track field changes. It seems usefull for future development.