container() === '') { return; } Assets::enqueue(); } /** * Prints the banner mount node on eligible admin screens * * @return void */ public function renderMountPoint() { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Mount escapes echo $this->container(); } /** * notifications.js wraps a container carrying data-admin-notice in * admin-notice spacing. * * @return string */ private function container() { $slot = $this->currentSlot(); return $slot ? Mount::container($slot, ['data-admin-notice']) : ''; } private function currentSlot() { $screen = \get_current_screen(); if (!$screen) { return null; } if ($screen->id === 'dashboard') { return Slots::ADMIN_DASHBOARD; } return $this->isExcludedScreen($screen) ? null : Slots::ADMIN_OTHERS; } private function isExcludedScreen($screen) { if ($screen->base === 'post') { return true; } $excludedIds = ['site-editor', 'plugins', 'plugin-install', 'plugin-editor']; if (in_array($screen->id, $excludedIds, true)) { return true; } return strpos($screen->id, '_page_') !== false; } }