Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_mce_set_direction() WordPress Function

The mce_set_direction() function is used to set the text direction for a specified editor instance. The function takes two parameters: the first is the editor ID and the second is the desired text direction.

_mce_set_direction( array $mce_init ) #

Set the localized direction for MCE plugin.


Description

Will only set the direction to ‘rtl’, if the WordPress locale has the text direction set to ‘rtl’.

Fills in the ‘directionality’ setting, enables the ‘directionality’ plugin, and adds the ‘ltr’ button to ‘toolbar1’, formerly ‘theme_advanced_buttons1’ array keys. These keys are then returned in the $mce_init (TinyMCE settings) array.


Top ↑

Parameters

$mce_init

(array)(Required)MCE settings array.


Top ↑

Return

(array) Direction set for 'rtl', if needed by locale.


Top ↑

Source

File: wp-includes/functions.php

function _mce_set_direction( $mce_init ) {
	if ( is_rtl() ) {
		$mce_init['directionality'] = 'rtl';
		$mce_init['rtl_ui']         = true;

		if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
			$mce_init['plugins'] .= ',directionality';
		}

		if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
			$mce_init['toolbar1'] .= ',ltr';
		}
	}

	return $mce_init;
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More