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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Switching tinyMCE direction with RTL content


Go to End


2829 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