Skip to content

Commit

Permalink
Untangle: Remove the Import screen exception for Classic admin style …
Browse files Browse the repository at this point in the history
…(#35258)

* Remove import screen exception from classic admin option

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/7787048333
  • Loading branch information
DustyReagan authored and matticbot committed Feb 5, 2024
1 parent e507a40 commit 0c2c056
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This is an alpha version! The changes listed here are not final.

### Other changes <!-- Non-user-facing changes go here. This section will not be copied to readme.txt. -->
- Add Jetpack Manage banner in the Dashboard
- Admin Interface: remove exception for Import screen on Classic style
- AI Proofread plugin: add feature to the event props
- Fix issue where there are two Jetpack menu items that link users to Jetpack Backup
- Jetpack AI: add loading state to the usage panel.
Expand Down
2 changes: 1 addition & 1 deletion modules/masterbar/admin-menu/class-admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function reregister_menu_items() {
*/
public function get_preferred_view( $screen, $fallback_global_preference = true ) {
$force_default_view = in_array( $screen, array( 'users.php', 'options-general.php' ), true );
$use_wp_admin = $this->use_wp_admin_interface( $screen );
$use_wp_admin = $this->use_wp_admin_interface();

// When no preferred view has been set for "Users > All Users" or "Settings > General", keep the previous
// behavior that forced the default view regardless of the global preference.
Expand Down
29 changes: 5 additions & 24 deletions modules/masterbar/admin-menu/class-base-admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function __construct() {
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );

// Do not inject core mobile toggle when the user wants to use the WP Admin interface.
if ( ! $this->use_wp_admin_interface( 'jetpack' ) ) {
if ( ! $this->use_wp_admin_interface() ) {
add_action( 'adminmenu', array( $this, 'inject_core_mobile_toggle' ) );
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ public function enqueue_scripts() {
wp_style_add_data( 'jetpack-admin-menu', 'rtl', $this->is_rtl() );

// Load nav unification styles when the user isn't using wp-admin interface style.
if ( ! $this->use_wp_admin_interface( 'jetpack' ) ) {
if ( ! $this->use_wp_admin_interface() ) {
wp_enqueue_style(
'jetpack-admin-nav-unification',
plugins_url( 'admin-menu-nav-unification.css', __FILE__ ),
Expand Down Expand Up @@ -663,7 +663,7 @@ public function get_preferred_view( $screen, $fallback_global_preference = true
return self::UNKNOWN_VIEW;
}

$should_link_to_wp_admin = $this->should_link_to_wp_admin( $screen ) || $this->use_wp_admin_interface( $screen );
$should_link_to_wp_admin = $this->should_link_to_wp_admin( $screen ) || $this->use_wp_admin_interface();
return $should_link_to_wp_admin ? self::CLASSIC_VIEW : self::DEFAULT_VIEW;
}

Expand Down Expand Up @@ -779,29 +779,10 @@ public function inject_core_mobile_toggle() {
/**
* Whether the current user has indicated they want to use the wp-admin interface for the given screen.
*
* @param string $screen The current screen.
* @return bool
*/
public function use_wp_admin_interface( $screen ) {
$screen_excluded = $this->is_excluded_wp_admin_interface_screen( $screen );
return ! $screen_excluded && 'wp-admin' === get_option( 'wpcom_admin_interface' );
}

/**
* Returns whether we should default to wp_admin for the given screen.
*
* Screens that should not default to wp_admin when the wpcom_admin_interface is set.
* This applies to screens that have both a wp-admin and a Calypso interface.
*
* @param string $screen The current screen.
*
* @return bool
*/
protected function is_excluded_wp_admin_interface_screen( $screen ) {
$excluded_screens = array(
'import.php',
);
return in_array( $screen, $excluded_screens, true );
public function use_wp_admin_interface() {
return 'wp-admin' === get_option( 'wpcom_admin_interface' );
}

/**
Expand Down

0 comments on commit 0c2c056

Please sign in to comment.