Skip to content

Commit

Permalink
Plugin: Deprecate gutenberg_add_gutenberg_post_state (#13471)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and youknowriad committed Mar 6, 2019
1 parent c2c34c9 commit 890d9ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa
- The PHP function `gutenberg_filter_post_type_labels` has been removed.
- The PHP function `gutenberg_preload_api_request` has been removed. Use [`rest_preload_api_request`](https://developer.wordpress.org/reference/functions/rest_preload_api_request/) instead.
- 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 @@ -369,18 +369,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

0 comments on commit 890d9ee

Please sign in to comment.