WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

_WP_Editors::parse_settings() public WP 3.3.0

Parse default arguments for the editor instance.

Это метод класса: _WP_Editors{}

Хуки из метода
Возвращает

Массив. Parsed arguments array.

Использование

$result = _WP_Editors::parse_settings( $editor_id, $settings );
$editor_id(строка) (обязательный)
HTML ID for the textarea and TinyMCE and Quicktags instances. Should not contain square brackets.
$settings(массив) (обязательный)

Array of editor arguments.

  • wpautop(true/false)
    Whether to use wpautop().
    По умолчанию: true

  • media_buttons(true/false)
    Whether to show the Add Media/other media buttons.

  • default_editor(строка)
    When both TinyMCE and Quicktags are used, set which editor is shown on page load.
    По умолчанию: ''

  • drag_drop_upload(true/false)
    Whether to enable drag & drop on the editor uploading. Requires the media modal.
    По умолчанию: false

  • textarea_name(строка)
    Give the textarea a unique name here. Square brackets can be used here.
    По умолчанию: $editor_id

  • textarea_rows(число)
    Number rows in the editor textarea.
    По умолчанию: 20

  • tabindex(строка/число)
    Tabindex value to use.
    По умолчанию: ''

  • tabfocus_elements(строка)
    The previous and next element ID to move the focus to when pressing the Tab key in TinyMCE.
    По умолчанию: ':prev,:next'

  • editor_css(строка)
    Intended for extra styles for both Visual and Text editors. Should include <style> tags, and can use "scoped".
    По умолчанию: ''

  • editor_class(строка)
    Extra classes to add to the editor textarea element.
    По умолчанию: ''

  • teeny(true/false)
    Whether to output the minimal editor config. Examples include Press This and the Comment editor.
    По умолчанию: false

  • dfw(true/false)
    Deprecated in 4.1. Unused.

  • tinymce(true/false/массив)
    Whether to load TinyMCE. Can be used to pass settings directly to TinyMCE using an array.
    По умолчанию: true

  • quicktags(true/false/массив)
    Whether to load Quicktags. Can be used to pass settings directly to Quicktags using an array.
    По умолчанию: true

Список изменений

С версии 3.3.0 Введена.

Код _WP_Editors::parse_settings() WP 5.5.1

wp-includes/class-wp-editor.php
<?php
public static function parse_settings( $editor_id, $settings ) {

	/**
	 * Filters the wp_editor() settings.
	 *
	 * @since 4.0.0
	 *
	 * @see _WP_Editors::parse_settings()
	 *
	 * @param array  $settings  Array of editor arguments.
	 * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
	 *                          when called from block editor's Classic block.
	 */
	$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );

	$set = wp_parse_args(
		$settings,
		array(
			// Disable autop if the current post has blocks in it.
			'wpautop'             => ! has_blocks(),
			'media_buttons'       => true,
			'default_editor'      => '',
			'drag_drop_upload'    => false,
			'textarea_name'       => $editor_id,
			'textarea_rows'       => 20,
			'tabindex'            => '',
			'tabfocus_elements'   => ':prev,:next',
			'editor_css'          => '',
			'editor_class'        => '',
			'teeny'               => false,
			'_content_editor_dfw' => false,
			'tinymce'             => true,
			'quicktags'           => true,
		)
	);

	self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );

	if ( self::$this_tinymce ) {
		if ( false !== strpos( $editor_id, '[' ) ) {
			self::$this_tinymce = false;
			_deprecated_argument( 'wp_editor()', '3.9.0', 'TinyMCE editor IDs cannot have brackets.' );
		}
	}

	self::$this_quicktags = (bool) $set['quicktags'];

	if ( self::$this_tinymce ) {
		self::$has_tinymce = true;
	}

	if ( self::$this_quicktags ) {
		self::$has_quicktags = true;
	}

	if ( empty( $set['editor_height'] ) ) {
		return $set;
	}

	if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
		// A cookie (set when a user resizes the editor) overrides the height.
		$cookie = (int) get_user_setting( 'ed_size' );

		if ( $cookie ) {
			$set['editor_height'] = $cookie;
		}
	}

	if ( $set['editor_height'] < 50 ) {
		$set['editor_height'] = 50;
	} elseif ( $set['editor_height'] > 5000 ) {
		$set['editor_height'] = 5000;
	}

	return $set;
}