_mce_set_direction

Set the localized direction for MCE plugin.

Description

(array) _mce_set_direction( (array) $mce_init ); 

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.

Returns (array)

Direction set for 'rtl', if needed by locale.

Parameters (1)

0. $mce_init (array)
MCE settings array.

Usage

  1. if ( !function_exists( '_mce_set_direction' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // MCE settings array. 
  5. $mce_init = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _mce_set_direction($mce_init); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function _mce_set_direction( $mce_init ) { 
  2. if ( is_rtl() ) { 
  3. $mce_init['directionality'] = 'rtl'; 
  4. $mce_init['rtl_ui'] = true; 
  5.  
  6. if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) { 
  7. $mce_init['plugins'] .= ', directionality'; 
  8.  
  9. if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) { 
  10. $mce_init['toolbar1'] .= ', ltr'; 
  11.  
  12. return $mce_init;