| @@ -13,8 +13,9 @@ | ||
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | 15 | \add_action('admin_enqueue_scripts', [$this, 'loadScriptsAndStyles']); |
| 16 | 16 | \add_action('admin_notices', [$this, 'renderMountPoint']); |
| 17 | + \add_action('admin_footer', [$this, 'renderModalMountPoint']); | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Adds the banner bundle on eligible admin screens |
| @@ -22,9 +23,9 @@ | ||
| 22 | 23 | * @return void |
| 23 | 24 | */ |
| 24 | 25 | public function loadScriptsAndStyles() |
| 25 | 26 | { |
| 26 | - if ($this->container() === '') { | |
| 27 | + if ($this->container() === '' && $this->modalContainer() === '') { | |
| 27 | 28 | return; |
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | Assets::enqueue(); |
| @@ -41,8 +42,19 @@ | ||
| 41 | 42 | echo $this->container(); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | /** |
| 46 | + * Prints the modal mount node on screens admin_notices never reaches | |
| 47 | + * | |
| 48 | + * @return void | |
| 49 | + */ | |
| 50 | + public function renderModalMountPoint() | |
| 51 | + { | |
| 52 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Mount escapes | |
| 53 | + echo $this->modalContainer(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 45 | 57 | * notifications.js wraps a container carrying data-admin-notice in |
| 46 | 58 | * admin-notice spacing. |
| 47 | 59 | * |
| 48 | 60 | * @return string |
| @@ -50,8 +62,13 @@ | ||
| 50 | 62 | private function container() |
| 51 | 63 | { |
| 52 | 64 | $slot = $this->currentSlot(); |
| 53 | 65 | return $slot ? Mount::container($slot, ['data-admin-notice']) : ''; |
| 66 | + } | |
| 67 | + | |
| 68 | + private function modalContainer() | |
| 69 | + { | |
| 70 | + return Mount::container(Slots::ADMIN_MODAL); | |
| 54 | 71 | } |
| 55 | 72 | |
| 56 | 73 | private function currentSlot() |
| 57 | 74 | { |