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_get_block_categories #13454

Merged
merged 1 commit into from
Jan 25, 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 @@ -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