Skip to content

Commit

Permalink
Plugin: Deprecate gutenberg_add_gutenberg_post_state
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 24, 2019
1 parent 884cabf commit 1556bf2
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 @@ -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.

## 4.5.0
- `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed.
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

0 comments on commit 1556bf2

Please sign in to comment.