Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

Switching tinyMCE direction with RTL content


Go to End
Reply


2236 Views

Avatar
sajok

Community Member, 82 Posts

26 January 2010 at 5:13am

Hello

I'm working on a mulitilanguage website with arabic as the default language and French. I'm trying to set the directionality option in TinyMCE to RTL for Arabic content only:

In mysite/code/page.php I added:

public function getCMSFields() {
$fields = parent::getCMSFields();
$locale = Translatable::get_current_locale();
if ($locale == 'ar_MA') {
HtmlEditorConfig::get('cms')->setOption('directionality', 'rtl');

return $fields;
}
}

Using this code I can edite content in Arabic easily from right to left. However, I can't access to the french translation pagewhen I click on it.

I assume the problem is caused by the conditional "if ($locale == 'ar_MA')" which I added to the code, since i'm not sure of the correct way to do it. I appreciate any help..

thanks