get_block_editor_server_block_settings example

sprintf(
                    'wp.domReady( function() { wp.customizeWidgets.initialize( "widgets-customizer", %s ); } );',
                    wp_json_encode( $editor_settings )
                )
            );

            // Preload server-registered block schemas.             wp_add_inline_script(
                'wp-blocks',
                'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
            );

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

            wp_enqueue_script( 'wp-customize-widgets' );
            wp_enqueue_style( 'wp-customize-widgets' );

            
$initial_edits['content'] = $post->post_content;
    }

    if ( post_type_supports( $post->post_type, 'excerpt' ) ) {
        $initial_edits['excerpt'] = $post->post_excerpt;
    }
}

// Preload server-registered block schemas. wp_add_inline_script(
    'wp-blocks',
    'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);

// Get admin url for handling meta boxes. $meta_box_url = admin_url( 'post.php' );
$meta_box_url = add_query_arg(
    array(
        'post'                  => $post->ID,
        'action'                => 'edit',
        'meta-box-loader'       => true,
        'meta-box-loader-nonce' => wp_create_nonce( 'meta-box-loader' ),
    ),
    
sprintf(
        'wp.domReady( function() { wp.editSite.initializeEditor( "site-editor", %s ); } );',
        wp_json_encode( $editor_settings )
    )
);

// Preload server-registered block schemas. wp_add_inline_script(
    'wp-blocks',
    'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);

wp_add_inline_script(
    'wp-blocks',
    sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( isset( $editor_settings['blockCategories'] ) ? $editor_settings['blockCategories'] : array() ) ),
    'after'
);

wp_enqueue_script( 'wp-edit-site' );
wp_enqueue_script( 'wp-format-library' );
wp_enqueue_style( 'wp-edit-site' );
sprintf(
        'wp.domReady( function() { wp.editWidgets.initialize( "widgets-editor", %s ); } );',
        wp_json_encode( $editor_settings )
    )
);

// Preload server-registered block schemas. wp_add_inline_script(
    'wp-blocks',
    'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);

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

wp_enqueue_script( 'wp-edit-widgets' );
wp_enqueue_script( 'admin-widgets' );
wp_enqueue_style( 'wp-edit-widgets' );

Home | Imprint | This part of the site doesn't use cookies.