Make WordPress Core


Ignore:
Timestamp:
09/04/2020 09:46:11 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Further correct placement for wp_editor_expand filter DocBlock.

This ensures that the filter is only applied if the conditions before it are evaluated to true.

Follow-up to [48714].

Props johnbillion.
See #50768.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r48714 r48942  
    4545$_content_editor_dfw = false;
    4646
    47 /**
    48  * Filters whether to enable the 'expand' functionality in the post editor.
    49  *
    50  * @since 4.0.0
    51  * @since 4.1.0 Added the `$post_type` parameter.
    52  *
    53  * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
    54  * @param string $post_type Post type.
    55  */
    56 $_wp_editor_expand_enabled = apply_filters( 'wp_editor_expand', true, $post_type );
    57 
    5847if ( post_type_supports( $post_type, 'editor' )
    5948    && ! wp_is_mobile()
    6049    && ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) )
    61     && $_wp_editor_expand_enabled
    6250) {
    63 
    64     wp_enqueue_script( 'editor-expand' );
    65     $_content_editor_dfw = true;
    66     $_wp_editor_expand   = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
     51    /**
     52     * Filters whether to enable the 'expand' functionality in the post editor.
     53     *
     54     * @since 4.0.0
     55     * @since 4.1.0 Added the `$post_type` parameter.
     56     *
     57     * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
     58     * @param string $post_type Post type.
     59     */
     60    if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) {
     61        wp_enqueue_script( 'editor-expand' );
     62        $_content_editor_dfw = true;
     63        $_wp_editor_expand   = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
     64    }
    6765}
    6866
Note: See TracChangeset for help on using the changeset viewer.