get_block_categories example


            );

            // 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' );

            /** This action is documented in edit-form-blocks.php */
            do_action( 'enqueue_block_editor_assets' );
        }
    }

    

function get_block_editor_settings( array $custom_settings$block_editor_context ) {
    $editor_settings = array_merge(
        get_default_block_editor_settings(),
        array(
            'allowedBlockTypes' => get_allowed_block_types( $block_editor_context ),
            'blockCategories'   => get_block_categories( $block_editor_context ),
        ),
        $custom_settings
    );

    $global_styles = array();
    $presets       = array(
        array(
            'css'            => 'variables',
            '__unstableType' => 'presets',
            'isGlobalStyles' => true,
        ),
        
array( rest_get_route_for_post_type_items( 'wp_block' ), 'OPTIONS' ),
    array( rest_get_route_for_post_type_items( 'wp_template' ), 'OPTIONS' ),
    sprintf( '%s/autosaves?context=edit', $rest_path ),
    '/wp/v2/settings',
    array( '/wp/v2/settings', 'OPTIONS' ),
);

block_editor_rest_api_preload( $preload_paths$block_editor_context );

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

/* * Assign initial edits, if applicable. These are not initially assigned to the persisted post, * but should be included in its save payload. */
$initial_edits = array();
$is_new_post   = false;
if ( 'auto-draft' === $post->post_status ) {
    $is_new_post = true;
    

);

// 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' );

/** This action is documented in wp-admin/edit-form-blocks.php */
do_action( 'enqueue_block_editor_assets' );

/** This action is documented in wp-admin/widgets-form.php */
Home | Imprint | This part of the site doesn't use cookies.