On this page
_wp_get_iframed_editor_assets(): array
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Collect the block editor assets that need to be loaded into the editor’s iframe.
Return
array The block editor assets.
stylesstring|falseString containing the HTML for styles.scriptsstring|falseString containing the HTML for scripts.
Source
File: wp-includes/block-editor.php. View all references
function _wp_get_iframed_editor_assets() {
global $pagenow;
$script_handles = array();
$style_handles = array(
'wp-block-editor',
'wp-block-library',
'wp-edit-blocks',
);
if ( current_theme_supports( 'wp-block-styles' ) ) {
$style_handles[] = 'wp-block-library-theme';
}
if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) {
$style_handles[] = 'wp-widgets';
$style_handles[] = 'wp-edit-widgets';
}
$block_registry = WP_Block_Type_Registry::get_instance();
foreach ( $block_registry->get_all_registered() as $block_type ) {
$style_handles = array_merge(
$style_handles,
$block_type->style_handles,
$block_type->editor_style_handles
);
$script_handles = array_merge(
$script_handles,
$block_type->script_handles
);
}
$style_handles = array_unique( $style_handles );
$done = wp_styles()->done;
ob_start();
// We do not need reset styles for the iframed editor.
wp_styles()->done = array( 'wp-reset-editor-styles' );
wp_styles()->do_items( $style_handles );
wp_styles()->done = $done;
$styles = ob_get_clean();
$script_handles = array_unique( $script_handles );
$done = wp_scripts()->done;
ob_start();
wp_scripts()->done = array();
wp_scripts()->do_items( $script_handles );
wp_scripts()->done = $done;
$scripts = ob_get_clean();
return array(
'styles' => $styles,
'scripts' => $scripts,
);
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Block_Type_Registry::get_instance() wp-includes/class-wp-block-type-registry.php | Utility method to retrieve the main instance of the class. |
| wp_styles() wp-includes/functions.wp-styles.php | Initialize $wp_styles if it has not been set. |
| wp_scripts() wp-includes/functions.wp-scripts.php | Initialize $wp_scripts if it has not been set. |
| current_theme_supports() wp-includes/theme.php | Checks a theme’s support for a given feature. |
Used By
| Used By | Description |
|---|---|
| get_block_editor_settings() wp-includes/block-editor.php | Returns the contextualized block editor settings for a selected editor context. |
Changelog
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_get_iframed_editor_assets