get_default_block_template_types example


function _build_block_template_result_from_file( $template_file$template_type ) {
    $default_template_types = get_default_block_template_types();
    $template_content       = file_get_contents( $template_file['path'] );
    $theme                  = get_stylesheet();

    $template                 = new WP_Block_Template();
    $template->id             = $theme . '//' . $template_file['slug'];
    $template->theme          = $theme;
    $template->content        = _inject_theme_attribute_in_block_template_content( $template_content );
    $template->slug           = $template_file['slug'];
    $template->source         = 'theme';
    $template->type           = $template_type;
    $template->title          = ! empty( $template_file['title'] ) ? $template_file['title'] : $template_file['slug'];
    
$current_screen->is_block_editor( true );

// Default to is-fullscreen-mode to avoid jumps in the UI. add_filter(
    'admin_body_class',
    static function( $classes ) {
        return "$classes is-fullscreen-mode";
    }
);

$indexed_template_types = array();
foreach ( get_default_block_template_types() as $slug => $template_type ) {
    $template_type['slug']    = (string) $slug;
    $indexed_template_types[] = $template_type;
}

$block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) );
$custom_settings      = array(
    'siteUrl'                   => site_url(),
    'postsPerPage'              => get_option( 'posts_per_page' ),
    'styles'                    => get_block_editor_theme_styles(),
    'defaultTemplateTypes'      => $indexed_template_types,
    'defaultTemplatePartAreas'  => get_allowed_block_template_part_areas(),
    
Home | Imprint | This part of the site doesn't use cookies.