wp/wp-includes/block-editor.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   221 		'imageDefaultSize'                 => $image_default_size,
   221 		'imageDefaultSize'                 => $image_default_size,
   222 		'imageDimensions'                  => $image_dimensions,
   222 		'imageDimensions'                  => $image_dimensions,
   223 		'imageEditing'                     => true,
   223 		'imageEditing'                     => true,
   224 		'imageSizes'                       => $available_image_sizes,
   224 		'imageSizes'                       => $available_image_sizes,
   225 		'maxUploadFileSize'                => $max_upload_size,
   225 		'maxUploadFileSize'                => $max_upload_size,
       
   226 		'__experimentalDashboardLink'      => admin_url( '/' ),
   226 		// The following flag is required to enable the new Gallery block format on the mobile apps in 5.9.
   227 		// The following flag is required to enable the new Gallery block format on the mobile apps in 5.9.
   227 		'__unstableGalleryWithImageBlocks' => true,
   228 		'__unstableGalleryWithImageBlocks' => true,
   228 	);
   229 	);
   229 
   230 
   230 	$theme_settings = get_classic_theme_supports_block_editor_settings();
   231 	$theme_settings = get_classic_theme_supports_block_editor_settings();
   364 	}
   365 	}
   365 
   366 
   366 	ob_start();
   367 	ob_start();
   367 	wp_print_styles();
   368 	wp_print_styles();
   368 	wp_print_font_faces();
   369 	wp_print_font_faces();
       
   370 	wp_print_font_faces_from_style_variations();
   369 	$styles = ob_get_clean();
   371 	$styles = ob_get_clean();
   370 
   372 
   371 	if ( $has_emoji_styles ) {
   373 	if ( $has_emoji_styles ) {
   372 		add_action( 'wp_print_styles', 'print_emoji_styles' );
   374 		add_action( 'wp_print_styles', 'print_emoji_styles' );
   373 	}
   375 	}
   530 		/*
   532 		/*
   531 		 * Add the custom CSS as a separate stylesheet so any invalid CSS
   533 		 * Add the custom CSS as a separate stylesheet so any invalid CSS
   532 		 * entered by users does not break other global styles.
   534 		 * entered by users does not break other global styles.
   533 		 */
   535 		 */
   534 		$global_styles[] = array(
   536 		$global_styles[] = array(
   535 			'css'            => wp_get_global_styles_custom_css(),
   537 			'css'            => wp_get_global_stylesheet( array( 'custom-css' ) ),
   536 			'__unstableType' => 'user',
   538 			'__unstableType' => 'user',
   537 			'isGlobalStyles' => true,
   539 			'isGlobalStyles' => true,
   538 		);
   540 		);
   539 	} else {
   541 	} else {
   540 		// If there is no `theme.json` file, ensure base layout styles are still available.
   542 		// If there is no `theme.json` file, ensure base layout styles are still available.
   645 	$post_content_block_attributes = wp_get_post_content_block_attributes();
   647 	$post_content_block_attributes = wp_get_post_content_block_attributes();
   646 
   648 
   647 	if ( isset( $post_content_block_attributes ) ) {
   649 	if ( isset( $post_content_block_attributes ) ) {
   648 		$editor_settings['postContentAttributes'] = $post_content_block_attributes;
   650 		$editor_settings['postContentAttributes'] = $post_content_block_attributes;
   649 	}
   651 	}
       
   652 
       
   653 	$editor_settings['canUpdateBlockBindings'] = current_user_can( 'edit_block_binding', $block_editor_context );
   650 
   654 
   651 	/**
   655 	/**
   652 	 * Filters the settings to pass to the block editor for all editor type.
   656 	 * Filters the settings to pass to the block editor for all editor type.
   653 	 *
   657 	 *
   654 	 * @since 5.8.0
   658 	 * @since 5.8.0
   850 		$theme_settings['spacingSizes'] = $spacing_sizes;
   854 		$theme_settings['spacingSizes'] = $spacing_sizes;
   851 	}
   855 	}
   852 
   856 
   853 	return $theme_settings;
   857 	return $theme_settings;
   854 }
   858 }
       
   859 
       
   860 /**
       
   861  * Initialize site preview.
       
   862  *
       
   863  * This function sets IFRAME_REQUEST to true if the site preview parameter is set.
       
   864  *
       
   865  * @since 6.8.0
       
   866  */
       
   867 function wp_initialize_site_preview_hooks() {
       
   868 	if (
       
   869 		! defined( 'IFRAME_REQUEST' ) &&
       
   870 		isset( $_GET['wp_site_preview'] ) &&
       
   871 		1 === (int) $_GET['wp_site_preview'] &&
       
   872 		current_user_can( 'edit_theme_options' )
       
   873 	) {
       
   874 		define( 'IFRAME_REQUEST', true );
       
   875 	}
       
   876 }