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

Plugin: Deprecate gutenberg_add_gutenberg_post_state #13471

Merged
merged 2 commits into from
Jan 28, 2019
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
Expand Up @@ -22,6 +22,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa
- The PHP function `gutenberg_silence_rest_errors` has been removed.
- The PHP function `gutenberg_filter_post_type_labels` has been removed.
- The PHP function `gutenberg_remove_wpcom_markdown_support` has been removed.
- The PHP function `gutenberg_add_gutenberg_post_state` has been removed.
- The PHP function `gutenberg_bulk_post_updated_messages` has been removed.
- The PHP function `gutenberg_kses_allowedtags` has been removed.
- The PHP function `gutenberg_add_responsive_body_class` has been removed.
Expand Down
14 changes: 6 additions & 8 deletions lib/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,18 +421,16 @@ function gutenberg_content_block_version( $content ) {
/**
* Adds a "Gutenberg" post state for post tables, if the post contains blocks.
*
* @param array $post_states An array of post display states.
* @param WP_Post $post The current post object.
* @return array A filtered array of post display states.
* @deprecated 5.0.0
*
* @param array $post_states An array of post display states.
* @return array A filtered array of post display states.
*/
function gutenberg_add_gutenberg_post_state( $post_states, $post ) {
if ( has_blocks( $post ) ) {
$post_states[] = 'Gutenberg';
}
function gutenberg_add_gutenberg_post_state( $post_states ) {
_deprecated_function( __FUNCTION__, '5.0.0' );

return $post_states;
}
add_filter( 'display_post_states', 'gutenberg_add_gutenberg_post_state', 10, 2 );

/**
* Registers custom post types required by the Gutenberg editor.
Expand Down
15 changes: 0 additions & 15 deletions phpunit/class-admin-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,6 @@ function test_gutenberg_content_has_blocks() {
$this->assertFalse( gutenberg_content_has_blocks( $content_without_blocks ) );
}

/**
* Tests gutenberg_add_gutenberg_post_state().
*
* @covers ::gutenberg_add_gutenberg_post_state
*/
function test_add_gutenberg_post_state() {
// With blocks.
$post_states = apply_filters( 'display_post_states', array(), get_post( self::$post_with_blocks ) );
$this->assertEquals( array( 'Gutenberg' ), $post_states );

// Without blocks.
$post_states = apply_filters( 'display_post_states', array(), get_post( self::$post_without_blocks ) );
$this->assertEquals( array(), $post_states );
}

/**
* Test that the revisions 'return to editor' links are set correctly for Classic & Gutenberg editors.
*
Expand Down