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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48942 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-09-04 21:46:11 +00:00
parent d34a21c950
commit 267e754b83

View File

@ -44,26 +44,24 @@ wp_enqueue_script( 'post' );
$_wp_editor_expand = false;
$_content_editor_dfw = false;
/**
* Filters whether to enable the 'expand' functionality in the post editor.
*
* @since 4.0.0
* @since 4.1.0 Added the `$post_type` parameter.
*
* @param bool $expand Whether to enable the 'expand' functionality. Default true.
* @param string $post_type Post type.
*/
$_wp_editor_expand_enabled = apply_filters( 'wp_editor_expand', true, $post_type );
if ( post_type_supports( $post_type, 'editor' )
&& ! wp_is_mobile()
&& ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) )
&& $_wp_editor_expand_enabled
) {
wp_enqueue_script( 'editor-expand' );
$_content_editor_dfw = true;
$_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
/**
* Filters whether to enable the 'expand' functionality in the post editor.
*
* @since 4.0.0
* @since 4.1.0 Added the `$post_type` parameter.
*
* @param bool $expand Whether to enable the 'expand' functionality. Default true.
* @param string $post_type Post type.
*/
if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) {
wp_enqueue_script( 'editor-expand' );
$_content_editor_dfw = true;
$_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
}
}
if ( wp_is_mobile() ) {