WordPress.org

Make WordPress Core

Changeset 51390


Ignore:
Timestamp:
07/09/2021 10:49:15 AM (3 months ago)
Author:
SergeyBiryukov
Message:

Docs: Some documentation improvements for wp_check_widget_editor_deps():

  • Add missing short description for the function.
  • Correct function names in _doing_it_wrong() calls.
  • Document the usage of $wp_scripts and $wp_styles globals.
  • Update syntax for multi-line comment per the documentation standards.

Follow-up to [51387], [51388].

See #53437, #53569.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r51387 r51390  
    383383    );
    384384
    385     // wp-editor module is exposed as window.wp.editor
    386     // Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor
    387     // Solution: fuse the two objects together to maintain backward compatibility
    388     // For more context, see https://github.com/WordPress/gutenberg/issues/33203
     385    /*
     386     * wp-editor module is exposed as window.wp.editor.
     387     * Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor.
     388     * Solution: fuse the two objects together to maintain backward compatibility.
     389     * For more context, see https://github.com/WordPress/gutenberg/issues/33203.
     390     */
    389391    $scripts->add_inline_script(
    390392        'wp-editor',
     
    22702272 *
    22712273 * @since 5.8.0
    2272  *
    2273  * @return void
    22742274 */
    22752275function wp_enqueue_global_styles() {
  • trunk/src/wp-includes/widgets.php

    r51388 r51390  
    20092009
    20102010/**
     2011 * Displays a _doing_it_wrong() message for conflicting widget editor scripts.
     2012 *
    20112013 * The 'wp-editor' script module is exposed as window.wp.editor. This overrides
    20122014 * the legacy TinyMCE editor module which is required by the widgets editor.
    2013  * Because of that conflict, these two shouldn't be enqueued together. See
    2014  * https://core.trac.wordpress.org/ticket/53569.
     2015 * Because of that conflict, these two shouldn't be enqueued together.
     2016 * See https://core.trac.wordpress.org/ticket/53569.
    20152017 *
    20162018 * There is also another conflict related to styles where the block widgets
    2017  * editor is hidden if a block enqueues 'wp-edit-post' stylesheet. See
    2018  * https://core.trac.wordpress.org/ticket/53569.
     2019 * editor is hidden if a block enqueues 'wp-edit-post' stylesheet.
     2020 * See https://core.trac.wordpress.org/ticket/53569.
    20192021 *
    20202022 * @since 5.8.0
    20212023 * @access private
     2024 *
     2025 * @global WP_Scripts $wp_scripts
     2026 * @global WP_Styles  $wp_styles
    20222027 */
    20232028function wp_check_widget_editor_deps() {
    20242029    global $wp_scripts, $wp_styles;
     2030
    20252031    if (
    20262032        $wp_scripts->query( 'wp-edit-widgets', 'enqueued' ) ||
     
    20292035        if ( $wp_scripts->query( 'wp-editor', 'enqueued' ) ) {
    20302036            _doing_it_wrong(
    2031                 'enqueue_script',
     2037                'wp_enqueue_script()',
    20322038                '"wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets).',
    20332039                '5.8.0'
     
    20362042        if ( $wp_styles->query( 'wp-edit-post', 'enqueued' ) ) {
    20372043            _doing_it_wrong(
    2038                 'enqueue_style',
     2044                'wp_enqueue_style()',
    20392045                '"wp-edit-post" style should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets).',
    20402046                '5.8.0'
Note: See TracChangeset for help on using the changeset viewer.