From 2aa49fb8246b2003b1ea63a2d5bd01340032a48e Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Mon, 28 Jan 2019 11:42:28 -0500 Subject: [PATCH] Plugin: Remove lingering references to integrated Classic Editor --- .../backward-compatibility/deprecations.md | 3 ++ gutenberg.php | 24 +++--------- lib/client-assets.php | 2 +- lib/register.php | 32 +++++----------- phpunit/class-admin-test.php | 37 ------------------- 5 files changed, 19 insertions(+), 79 deletions(-) diff --git a/docs/designers-developers/developers/backward-compatibility/deprecations.md b/docs/designers-developers/developers/backward-compatibility/deprecations.md index f2ce4c1ee8d2f2..67ca14cff5e106 100644 --- a/docs/designers-developers/developers/backward-compatibility/deprecations.md +++ b/docs/designers-developers/developers/backward-compatibility/deprecations.md @@ -56,6 +56,9 @@ The Gutenberg project's deprecation policy is intended to support backward compa - The PHP function `gutenberg_meta_box_post_form_hidden_fields` has been removed. Use [`the_block_editor_meta_box_post_form_hidden_fields`](https://developer.wordpress.org/reference/functions/the_block_editor_meta_box_post_form_hidden_fields/) instead. - The PHP function `gutenberg_toggle_custom_fields` has been removed. - The PHP function `gutenberg_collect_meta_box_data` has been removed. Use [`register_and_do_post_meta_boxes`](https://developer.wordpress.org/reference/functions/register_and_do_post_meta_boxes/) instead. +- The PHP function `gutenberg_redirect_to_classic_editor_when_saving_posts` has been removed. +- The PHP function `gutenberg_revisions_link_to_editor` has been removed. +- The PHP function `gutenberg_remember_classic_editor_when_saving_posts` has been removed. ## 4.5.0 - `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed. diff --git a/gutenberg.php b/gutenberg.php index f91df4b9185978..4cf04148b7b16a 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -31,21 +31,11 @@ function the_gutenberg_project() { @@ -128,10 +118,6 @@ function is_gutenberg_page() { return false; } - if ( isset( $_GET['classic-editor'] ) ) { - return false; - } - if ( ! gutenberg_can_edit_post( $post ) ) { return false; } diff --git a/lib/client-assets.php b/lib/client-assets.php index c90cb8a05a8ff6..6e536740beae95 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -1189,7 +1189,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) { $post_autosave = gutenberg_get_autosave_newer_than_post_save( $post ); if ( $post_autosave ) { $editor_settings['autosave'] = array( - 'editLink' => add_query_arg( 'gutenberg', true, get_edit_post_link( $post_autosave->ID ) ), + 'editLink' => get_edit_post_link( $post_autosave->ID ), ); } diff --git a/lib/register.php b/lib/register.php index ebdc43c7f2e5c1..f8f7410d312534 100644 --- a/lib/register.php +++ b/lib/register.php @@ -203,67 +203,55 @@ function gutenberg_bulk_post_updated_messages( $messages ) { * Injects a hidden input in the edit form to propagate the information that classic editor is selected. * * @since 1.5.2 + * @deprecated 5.0.0 */ function gutenberg_remember_classic_editor_when_saving_posts() { - ?> - - assertTrue( gutenberg_content_has_blocks( $content_with_blocks ) ); $this->assertFalse( gutenberg_content_has_blocks( $content_without_blocks ) ); } - - /** - * Test that the revisions 'return to editor' links are set correctly for Classic & Gutenberg editors. - * - * @covers ::gutenberg_revisions_link_to_editor - */ - function test_gutenberg_revisions_link_to_editor() { - global $pagenow; - - // Set up $pagenow so the filter will work. - $pagenow = 'revision.php'; - - // Test the filter when Gutenberg is the active editor. - $_REQUEST['gutenberg'] = '1'; - $link = apply_filters( 'get_edit_post_link', 'http://test.com' ); - $this->assertEquals( 'http://test.com', $link ); - - // Test the filter when Gutenberg is not the active editor. - unset( $_REQUEST['gutenberg'] ); - $link = apply_filters( 'get_edit_post_link', 'http://test.com' ); - $this->assertEquals( 'http://test.com?classic-editor', $link ); - } - - /** - * Test that the revisions 'restore this revision' button links correctly for Classic & Gutenberg editors. - */ - function test_gutenberg_revisions_restore() { - // Test the filter when Gutenberg is the active editor. - $_REQUEST['gutenberg'] = '1'; - $link = apply_filters( 'wp_prepare_revision_for_js', array( 'restoreUrl' => 'http://test.com' ) ); - $this->assertEquals( array( 'restoreUrl' => 'http://test.com?gutenberg=1' ), $link ); - - // Test the filter when Gutenberg is not the active editor. - unset( $_REQUEST['gutenberg'] ); - $link = apply_filters( 'wp_prepare_revision_for_js', array( 'restoreUrl' => 'http://test.com' ) ); - $this->assertEquals( array( 'restoreUrl' => 'http://test.com' ), $link ); - } }