Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove classic view notice from general settings #41155

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: removed

removed classic view admin notice from general settings (for atomic sites)
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ function () {
},
0
);

// Add notices to the settings pages when there is a Calypso page available.
if ( $this->use_wp_admin_interface() ) {
add_action( 'current_screen', array( $this, 'add_settings_page_notice' ) );
}
}

/**
Expand Down Expand Up @@ -530,55 +525,4 @@ public function wp_ajax_jitm_dismiss() {
}
wp_die();
}

/**
* Adds a notice above each settings page while using the Classic view to indicate
* that the Default view offers more features. Links to the default view.
*
* @return void
*/
public function add_settings_page_notice() {
if ( ! is_admin() ) {
return;
}

$current_screen = get_current_screen();

if ( ! $current_screen instanceof \WP_Screen ) {
return;
}

// Show the notice for the following screens and map them to the Calypso page.
$screen_map = array(
'options-general' => 'general',
'options-reading' => 'reading',
);

$mapped_screen = $screen_map[ $current_screen->id ] ?? false;

if ( ! $mapped_screen ) {
return;
}

$switch_url = sprintf( 'https://wordpress.com/settings/%s/%s', $mapped_screen, $this->domain );

// Close over the $switch_url variable.
$admin_notices = function () use ( $switch_url ) {
wp_admin_notice(
wp_kses(
sprintf(
// translators: %s is a link to the Calypso settings page.
__( 'You are currently using the Classic view, which doesn’t offer the same set of features as the Default view. To access additional settings and features, <a href="%s">switch to the Default view</a>. ', 'jetpack-masterbar' ),
esc_url( $switch_url )
),
array( 'a' => array( 'href' => array() ) )
),
array(
'type' => 'warning',
)
);
};

add_action( 'admin_notices', $admin_notices );
}
}
Loading