← All changes
|
jetpack_vendor/automattic/jetpack-admin-ui/src/class-admin-menu.php
+12
-9
16.3-a.7
→
16.3-beta
View file →
| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | * If the Jetpack top level was not previously registered by other plugin, it will be registered here. |
| 18 | 18 | */ |
| 19 | 19 | class Admin_Menu { |
| 20 | 20 | |
| 21 | - const PACKAGE_VERSION = '0.14.2'; | |
| 21 | + const PACKAGE_VERSION = '0.14.3'; | |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Slug used for the upgrade menu item and redirect URL. |
| 25 | 25 | * |
| @@ -471,21 +471,24 @@ | ||
| 471 | 471 | self::$menu_items[] = compact( 'page_title', 'menu_title', 'capability', 'menu_slug', 'function', 'position', 'args' ); |
| 472 | 472 | |
| 473 | 473 | /** |
| 474 | 474 | * Let's return the page hook so consumers can use. |
| 475 | - * We know all pages will be under Jetpack top level menu page, so we can hardcode the first part of the string. | |
| 475 | + * Pages normally sit under the Jetpack top level menu page, so we can hardcode the first part of the string. | |
| 476 | 476 | * Using get_plugin_page_hookname here won't work because the top level page is not registered yet. |
| 477 | 477 | */ |
| 478 | 478 | $hook = 'jetpack_page_' . $menu_slug; |
| 479 | 479 | |
| 480 | - // Track the page hook so the design-tokens stylesheet can be scoped to it. | |
| 481 | - self::$page_hooks[] = $hook; | |
| 480 | + // Core names the page admin_page_<slug> instead when the user has no Jetpack top-level menu. | |
| 481 | + foreach ( array( $hook, 'admin_page_' . $menu_slug ) as $page_hook ) { | |
| 482 | + // Track the page hook so the design-tokens stylesheet can be scoped to it. | |
| 483 | + self::$page_hooks[] = $page_hook; | |
| 482 | 484 | |
| 483 | - // Hide WordPress core admin notices on this Jetpack page. The load-<hook> | |
| 484 | - // action only fires when the matching screen is being rendered, so this | |
| 485 | - // stays scoped to Jetpack pages and reaches every page registered here. | |
| 486 | - add_action( 'load-' . $hook, array( __CLASS__, 'hide_core_admin_notices' ) ); | |
| 487 | - add_action( 'load-' . $hook . '-network', array( __CLASS__, 'hide_core_admin_notices' ) ); | |
| 485 | + // Hide WordPress core admin notices on this Jetpack page. The load-<hook> | |
| 486 | + // action only fires when the matching screen is being rendered, so this | |
| 487 | + // stays scoped to Jetpack pages and reaches every page registered here. | |
| 488 | + add_action( 'load-' . $page_hook, array( __CLASS__, 'hide_core_admin_notices' ) ); | |
| 489 | + add_action( 'load-' . $page_hook . '-network', array( __CLASS__, 'hide_core_admin_notices' ) ); | |
| 490 | + } | |
| 488 | 491 | |
| 489 | 492 | return $hook; |
| 490 | 493 | } |
| 491 | 494 | |