mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
Editor: Abstract block editor configuration
There are several WordPress hooks defined on the server that depend on $post object that isn’t present on the new screens like edit site, edit widgets, or edit navigation. This patch deprecates existing filters and introduces replacements that are context-aware. Props azaozz, andraganescu, jeremyfelt, nosolosw, youknowriad. See #52920. git-svn-id: https://develop.svn.wordpress.org/trunk@50776 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2180,64 +2180,6 @@ function use_block_editor_for_post_type( $post_type ) {
|
||||
return apply_filters( 'use_block_editor_for_post_type', true, $post_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the block categories that will be shown in the block editor.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_Post $post Post object.
|
||||
* @return array[] Array of block categories.
|
||||
*/
|
||||
function get_block_categories( $post ) {
|
||||
$default_categories = array(
|
||||
array(
|
||||
'slug' => 'text',
|
||||
'title' => _x( 'Text', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
array(
|
||||
'slug' => 'media',
|
||||
'title' => _x( 'Media', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
array(
|
||||
'slug' => 'design',
|
||||
'title' => _x( 'Design', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
array(
|
||||
'slug' => 'widgets',
|
||||
'title' => _x( 'Widgets', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
array(
|
||||
'slug' => 'theme',
|
||||
'title' => _x( 'Theme', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
array(
|
||||
'slug' => 'embed',
|
||||
'title' => _x( 'Embeds', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
array(
|
||||
'slug' => 'reusable',
|
||||
'title' => _x( 'Reusable Blocks', 'block category' ),
|
||||
'icon' => null,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the default array of block categories.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array[] $default_categories Array of block categories.
|
||||
* @param WP_Post $post Post being loaded.
|
||||
*/
|
||||
return apply_filters( 'block_categories', $default_categories, $post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares server-registered blocks for the block editor.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user