Block Editor: Fix PHP warning when loading editor styles while in RTL.

In RTL languages, WordPress adds `style-editor-rtl.css` editor styles to the global `$editor_styles`.
This patch ignores handling these styles if the file is not preset.

Also, clarify the docs for the return value of the `block_version` function.

Props mostafa.s1990, desrosj, mukesh27.

Merges [43923] and [43924] to trunk.

Fixes #45288, #45342.
Built from https://develop.svn.wordpress.org/trunk@44270


git-svn-id: http://core.svn.wordpress.org/trunk@44100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2018-12-17 18:07:51 +00:00
parent bc9dfcfeb1
commit 4b0f960b7c
3 changed files with 9 additions and 7 deletions

View File

@ -197,11 +197,13 @@ if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
);
}
} else {
$file = get_theme_file_path( $style );
$styles[] = array(
'css' => file_get_contents( get_theme_file_path( $style ) ),
'baseURL' => get_theme_file_uri( $style ),
);
$file = get_theme_file_path( $style );
if ( file_exists( $file ) ) {
$styles[] = array(
'css' => file_get_contents( $file ),
'baseURL' => get_theme_file_uri( $style ),
);
}
}
}
}

View File

@ -283,7 +283,7 @@ function _restore_wpautop_hook( $content ) {
* @since 5.0.0
*
* @param string $content Content to test.
* @return int The block format version.
* @return int The block format version is 1 if the content contains one or more blocks, 0 otherwise.
*/
function block_version( $content ) {
return has_blocks( $content ) ? 1 : 0;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-alpha-44269';
$wp_version = '5.1-alpha-44270';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.