diff --git a/wire/core/PagesNames.php b/wire/core/PagesNames.php index e04b63fb..421c5d45 100644 --- a/wire/core/PagesNames.php +++ b/wire/core/PagesNames.php @@ -422,7 +422,7 @@ class PagesNames extends Wire { * * @param string|Page|array $name Name to make unique * You may optionally substitute the $page argument or $options arguments here, if that is all you need. - * @param Page||string|null|array Page to exclude from duplicate check and/or to pull $name or parent from (if not otherwise specified). + * @param Page|string|null|array Page to exclude from duplicate check and/or to pull $name or parent from (if not otherwise specified). * Note that specifying a Page is important if the page already exists, as it is used as the page to exclude when checking for * name collisions, and we want to exclude $page from that check. You may optionally substitute the $options or $name arguments * here, if that is all you need. If $parent or $name are specified separately from this $page argument, they will override diff --git a/wire/modules/System/SystemNotifications/SystemNotifications.module b/wire/modules/System/SystemNotifications/SystemNotifications.module index 4895a772..30045285 100644 --- a/wire/modules/System/SystemNotifications/SystemNotifications.module +++ b/wire/modules/System/SystemNotifications/SystemNotifications.module @@ -111,10 +111,23 @@ class SystemNotifications extends WireData implements Module { } } - if($page->template == 'admin' && !$this->wire('input')->get('modal')) { - $this->addHookAfter('AdminTheme::getExtraMarkup', $this, 'hookAdminThemeGetExtraMarkup'); + if($page->template == 'admin') { + if(!$this->wire('input')->get('modal')) { + $this->addHookAfter('AdminTheme::getExtraMarkup', $this, 'hookAdminThemeGetExtraMarkup'); + } + if($page->process == 'ProcessModule' && !$this->disabled) { + $this->wire()->modules->addHookAfter('isUninstallable', function(HookEvent $event) { + $class = $event->arguments(0); + if($class !== $this->className()) return; + $returnReason = $event->arguments(1); + if($returnReason) { + $event->return = 'You must set “Notification status” to “Off” before uninstalling.'; + } else { + $event->return = false; + } + }); + } } - } /** diff --git a/wire/modules/System/SystemNotifications/SystemNotificationsConfig.php b/wire/modules/System/SystemNotifications/SystemNotificationsConfig.php index 7db10df9..f91cd223 100644 --- a/wire/modules/System/SystemNotifications/SystemNotificationsConfig.php +++ b/wire/modules/System/SystemNotifications/SystemNotificationsConfig.php @@ -3,6 +3,8 @@ /** * Configuration class for the SystemNotifications module * + * @property string $systemUserName + * */ class SystemNotificationsConfig extends ModuleConfig {