Skip to content
Snippets Groups Projects

Feature/wpdesk notices action

Merged Krzysztof Dyszczyk requested to merge feature/wpdesk-notices-action into master
All threads resolved!
7 files
+ 403
6
Compare changes
  • Side-by-side
  • Inline

Files

+ 12
2
@@ -16,6 +16,8 @@ class Notice
const NOTICE_TYPE_SUCCESS = 'success';
const NOTICE_TYPE_INFO = 'info';
const ADMIN_FOOTER_BASE_PRIORITY = 9999999;
/**
* Notice type.
*
@@ -156,7 +158,11 @@ class Notice
{
if (!$this->actionAdded) {
add_action('admin_notices', [$this, 'showNotice'], $this->priority);
add_action('admin_footer', [$this, 'showNotice'], $this->priority);
add_action(
'admin_footer',
[$this, 'showNotice'],
self::ADMIN_FOOTER_BASE_PRIORITY + intval($this->priority)
);
$this->actionAdded = true;
}
}
@@ -165,7 +171,11 @@ class Notice
{
if ($this->actionAdded) {
remove_action('admin_notices', [$this, 'showNotice'], $this->priority);
remove_action('admin_footer', [$this, 'showNotice'], $this->priority);
remove_action(
'admin_footer',
[$this, 'showNotice'],
self::ADMIN_FOOTER_BASE_PRIORITY + intval($this->priority)
);
$this->actionAdded = false;
}
}
Loading