Jump to content

Output Warning Message in Admin when a page with children is unpublished


Orkun
 Share

Recommended Posts

Hi Guys

I am trying to output a warning message in the admin to the user if he unpublishes a page which has children pages.

This is the code I have inside my autoload sitehelper module.

$this->addHookBefore('Pages::unpublishReady', $this, 'notifyOnUnpublish');


public function notifyOnUnpublish(HookEvent $event) {
	$pages = $event->object;
	$page = $event->arguments(0);
	if($page->numChildren > 0) {
		$this->warning("You have unpublished a page which contains sub-pages. You need to move these sub-pages or unpublished them.");
	}
}

It works when I am on Page Edit Screen. But how can I make something like this work for the Pagetree Actions with ajax refreshing?

KR
Orkun

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...