WordPress.org

Make WordPress Core

Ticket #45634: 45634-Block-Editor.patch

File 45634-Block-Editor.patch, 8.0 KB (added by faisal03, 19 months ago)
  • src/wp-admin/edit-form-blocks.php

     
    2626        $title = $post_type_object->labels->edit_item;
    2727}
    2828
    29 // Flag that we're loading the block editor.
     29// Flag that we're loading the Block Editor.
    3030$current_screen = get_current_screen();
    3131$current_screen->is_block_editor( true );
    3232
     
    317317
    318318
    319319/**
    320  * Filters the settings to pass to the block editor.
     320 * Filters the settings to pass to the Block Editor.
    321321 *
    322322 * @since 5.0.0
    323323 *
     
    357357 * Call `add_action` on any hook before 'admin_enqueue_scripts'.
    358358 *
    359359 * In the function call you supply, simply use `wp_enqueue_script` and
    360  * `wp_enqueue_style` to add your functionality to the block editor.
     360 * `wp_enqueue_style` to add your functionality to the Block Editor.
    361361 *
    362362 * @since 5.0.0
    363363 */
  • src/wp-admin/includes/class-wp-screen.php

     
    179179        private $_screen_settings;
    180180
    181181        /**
    182          * Whether the screen is using the block editor.
     182         * Whether the screen is using the Block Editor.
    183183         *
    184184         * @since 5.0.0
    185185         * @var bool
     
    421421        }
    422422
    423423        /**
    424          * Sets or returns whether the block editor is loading on the current screen.
     424         * Sets or returns whether the Block Editor is loading on the current screen.
    425425         *
    426426         * @since 5.0.0
    427427         *
    428          * @param bool $set Optional. Sets whether the block editor is loading on the current screen or not.
    429          * @return bool True if the block editor is being loaded, false otherwise.
     428         * @param bool $set Optional. Sets whether the Block Editor is loading on the current screen or not.
     429         * @return bool True if the Block Editor is being loaded, false otherwise.
    430430         */
    431431        public function is_block_editor( $set = null ) {
    432432                if ( $set !== null ) {
  • src/wp-admin/includes/misc.php

     
    17311731         * @since 5.0.0 Added the `$blocks` parameter.
    17321732         *
    17331733         * @param bool $description Whether to include the descriptions under the section headings. Default false.
    1734          * @param bool $blocks      Whether to format the content for the block editor. Default true.
     1734         * @param bool $blocks      Whether to format the content for the Block Editor. Default true.
    17351735         * @return string The default policy content.
    17361736         */
    17371737        public static function get_default_content( $description = false, $blocks = true ) {
     
    19711971                 * @param $content     string The default policy content.
    19721972                 * @param $strings     array  An array of privacy policy content strings.
    19731973                 * @param $description bool   Whether policy descriptions should be included.
    1974                  * @param $blocks      bool   Whether the content should be formatted for the block editor.
     1974                 * @param $blocks      bool   Whether the content should be formatted for the Block Editor.
    19751975                 */
    19761976                return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
    19771977        }
  • src/wp-admin/includes/post.php

     
    20252025}
    20262026
    20272027/**
    2028  * Return whether the post can be edited in the block editor.
     2028 * Return whether the post can be edited in the Block Editor.
    20292029 *
    20302030 * @since 5.0.0
    20312031 *
    20322032 * @param int|WP_Post $post Post ID or WP_Post object.
    2033  * @return bool Whether the post can be edited in the block editor.
     2033 * @return bool Whether the post can be edited in the Block Editor.
    20342034 */
    20352035function use_block_editor_for_post( $post ) {
    20362036        $post = get_post( $post );
     
    20392039                return false;
    20402040        }
    20412041
    2042         // We're in the meta box loader, so don't use the block editor.
     2042        // We're in the meta box loader, so don't use the Block Editor.
    20432043        if ( isset( $_GET['meta-box-loader'] ) ) {
    20442044                check_admin_referer( 'meta-box-loader' );
    20452045                return false;
     
    20482048        $use_block_editor = use_block_editor_for_post_type( $post->post_type );
    20492049
    20502050        /**
    2051          * Filter whether a post is able to be edited in the block editor.
     2051         * Filter whether a post is able to be edited in the Block Editor.
    20522052         *
    20532053         * @since 5.0.0
    20542054         *
     
    20592059}
    20602060
    20612061/**
    2062  * Return whether a post type is compatible with the block editor.
     2062 * Return whether a post type is compatible with the Block Editor.
    20632063 *
    2064  * The block editor depends on the REST API, and if the post type is not shown in the
    2065  * REST API, then it won't work with the block editor.
     2064 * The Block Editor depends on the REST API, and if the post type is not shown in the
     2065 * REST API, then it won't work with the Block Editor.
    20662066 *
    20672067 * @since 5.0.0
    20682068 *
    20692069 * @param string $post_type The post type.
    2070  * @return bool Whether the post type can be edited with the block editor.
     2070 * @return bool Whether the post type can be edited with the Block Editor.
    20712071 */
    20722072function use_block_editor_for_post_type( $post_type ) {
    20732073        if ( ! post_type_exists( $post_type ) ) {
     
    20842084        }
    20852085
    20862086        /**
    2087          * Filter whether a post is able to be edited in the block editor.
     2087         * Filter whether a post is able to be edited in the Block Editor.
    20882088         *
    20892089         * @since 5.0.0
    20902090         *
     
    20952095}
    20962096
    20972097/**
    2098  * Returns all the block categories that will be shown in the block editor.
     2098 * Returns all the block categories that will be shown in the Block Editor.
    20992099 *
    21002100 * @since 5.0.0
    21012101 *
     
    21482148}
    21492149
    21502150/**
    2151  * Prepares server-registered blocks for the block editor.
     2151 * Prepares server-registered blocks for the Block Editor.
    21522152 *
    21532153 * Returns an associative array of registered block data keyed by block name. Data includes properties
    21542154 * of a block relevant for client registration.
  • src/wp-admin/includes/template.php

     
    11391139
    11401140                                        $block_compatible = true;
    11411141                                        if ( is_array( $box['args'] ) ) {
    1142                                                 // If a meta box is just here for back compat, don't show it in the block editor.
     1142                                                // If a meta box is just here for back compat, don't show it in the Block Editor.
    11431143                                                if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) {
    11441144                                                        continue;
    11451145                                                }
    11461146
    1147                                                 // If a meta box doesn't work in the block editor, don't show it in the block editor.
     1147                                                // If a meta box doesn't work in the Block Editor, don't show it in the Block Editor.
    11481148                                                if ( $screen->is_block_editor() && isset( $box['args']['__block_editor_compatible_meta_box'] ) && ! $box['args']['__block_editor_compatible_meta_box'] ) {
    11491149                                                        continue;
    11501150                                                }
     
    12121212                                                                                                <p>
    12131213                                                                                                        <?php
    12141214                                                                                                                /* translators: %s: the name of the plugin that generated this meta box. */
    1215                                                                                                                 printf( __( "This meta box, from the %s plugin, isn't compatible with the block editor." ), "<strong>{$plugin['Name']}</strong>" );
     1215                                                                                                                printf( __( "This meta box, from the %s plugin, isn't compatible with the Block Editor." ), "<strong>{$plugin['Name']}</strong>" );
    12161216                                                                                                        ?>
    12171217                                                                                                </p>
    12181218                                                                                        </div>
  • src/wp-content/themes/twentynineteen/functions.php

     
    237237add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );
    238238
    239239/**
    240  * Enqueue supplemental block editor styles.
     240 * Enqueue supplemental Block Editor styles.
    241241 */
    242242function twentynineteen_editor_customizer_styles() {
    243243