Make WordPress Core

Changeset 44270


Ignore:
Timestamp:
12/17/2018 06:06:42 PM (8 years ago)
Author:
desrosj
Message:

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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-admin/edit-form-blocks.php

    r44267 r44270  
    198198                        }
    199199                } else {
    200                         $file     = get_theme_file_path( $style );
    201                         $styles[] = array(
    202                                 'css'     => file_get_contents( get_theme_file_path( $style ) ),
    203                                 'baseURL' => get_theme_file_uri( $style ),
    204                         );
     200                        $file = get_theme_file_path( $style );
     201                        if ( file_exists( $file ) ) {
     202                                $styles[] = array(
     203                                        'css'     => file_get_contents( $file ),
     204                                        'baseURL' => get_theme_file_uri( $style ),
     205                                );
     206                        }
    205207                }
    206208        }
  • trunk/src/wp-includes/blocks.php

    r44261 r44270  
    284284 *
    285285 * @param string $content Content to test.
    286  * @return int The block format version.
     286 * @return int The block format version is 1 if the content contains one or more blocks, 0 otherwise.
    287287 */
    288288function block_version( $content ) {
Note: See TracChangeset for help on using the changeset viewer.