Skip to content

Commit

Permalink
Plugin: Deprecate gutenberg_get_block_categories
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 25, 2019
1 parent bd6158d commit caa5d2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa
- The PHP function `gutenberg_block_bulk_actions` has been removed.
- The PHP function `gutenberg_replace_default_add_new_button` has been removed.
- The PHP function `gutenberg_content_block_version` has been removed. Use [`block_version`](https://developer.wordpress.org/reference/functions/block_version/) instead.
- The PHP function `gutenberg_get_block_categories` has been removed. Use [`get_block_categories`](https://developer.wordpress.org/reference/functions/get_block_categories/) instead.

## 4.5.0
- `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed.
Expand Down
38 changes: 4 additions & 34 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,45 +889,15 @@ function gutenberg_get_autosave_newer_than_post_save( $post ) {
* Returns all the block categories.
*
* @since 2.2.0
* @deprecated 5.0.0 get_block_categories
*
* @param WP_Post $post Post object.
* @return Object[] Block categories.
*/
function gutenberg_get_block_categories( $post ) {
$default_categories = array(
array(
'slug' => 'common',
'title' => __( 'Common Blocks', 'gutenberg' ),
'icon' => null,
),
array(
'slug' => 'formatting',
'title' => __( 'Formatting', 'gutenberg' ),
'icon' => null,
),
array(
'slug' => 'layout',
'title' => __( 'Layout Elements', 'gutenberg' ),
'icon' => null,
),
array(
'slug' => 'widgets',
'title' => __( 'Widgets', 'gutenberg' ),
'icon' => null,
),
array(
'slug' => 'embed',
'title' => __( 'Embeds', 'gutenberg' ),
'icon' => null,
),
array(
'slug' => 'reusable',
'title' => __( 'Reusable Blocks', 'gutenberg' ),
'icon' => null,
),
);
_deprecated_function( __FUNCTION__, '5.0.0', 'get_block_categories' );

return apply_filters( 'block_categories', $default_categories, $post );
return get_block_categories( $post );
}

/**
Expand Down Expand Up @@ -1092,7 +1062,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {

wp_add_inline_script(
'wp-blocks',
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( gutenberg_get_block_categories( $post ) ) ),
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $post ) ) ),
'after'
);

Expand Down

0 comments on commit caa5d2a

Please sign in to comment.