Skip to content

Commit

Permalink
Remove classic view notice from general settings (#41155)
Browse files Browse the repository at this point in the history
* remove calypso notice from general settings

* changelog
  • Loading branch information
madhusudhand authored Jan 22, 2025
1 parent 9bdc90a commit f8f52ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 56 deletions.
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 );
}
}

0 comments on commit f8f52ab

Please sign in to comment.