get_block_editor_theme_styles() – Creates an array of theme styles to load into the block editor.

You appear to be a bot. Output may be restricted

Description

Creates an array of theme styles to load into the block editor.

Usage

$array = get_block_editor_theme_styles();

Parameters

Returns

array An array of theme styles for the block editor.

Source

File name: wordpress/wp-includes/block-editor.php
Lines:

1 to 32 of 32
function get_block_editor_theme_styles() {
  global $editor_styles;

  $styles = array();

  if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
    foreach ( $editor_styles as $style ) {
      if ( preg_match( '~^(https?:)?//~', $style ) ) {
        $response = wp_remote_get( $style );
        if ( ! is_wp_error( $response ) ) {
          $styles[] = array(
            'css'            => wp_remote_retrieve_body( $response ),
            '__unstableType' => 'theme',
            'isGlobalStyles' => false,
          );
        }
      } else {
        $file = get_theme_file_path( $style );
        if ( is_file( $file ) ) {
          $styles[] = array(
            'css'            => file_get_contents( $file ),
            'baseURL'        => get_theme_file_uri( $style ),
            '__unstableType' => 'theme',
            'isGlobalStyles' => false,
          );
        }
      }
    }
  }

  return $styles;
}
 

 View on GitHub View on Trac