kreativan
10/2/2019 - 7:15 AM

Page Save Hook

<?php
/**
 *	This will hook after any page save
 * 
 */ 

$this->addHook('Pages::saved', function(HookEvent $event) {
	
    $page = $event->arguments[0];
    
	if($page->template == "home") {
		$this->warning($page->template->name);
	}
	
});


/**
 *  Page Save Hook
 * 
 */
public function init() {
  $this->pages->addHookAfter('save', $this, 'exampleMethod');
}
public function exampleMethod($event) {
  $page = $event->arguments[0];
  $this->message("You just saved page: {$page->url}");
}