Jump to:

23374 Posts in 18175 Topics by 2866 members

General Questions

SilverStripe Forums » General Questions » Switching tinyMCE direction with RTL content

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

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

Page: 1
Go to End
Author Topic: 1891 Views
  • sajok
    Avatar
    Community Member
    82 Posts

    Switching tinyMCE direction with RTL content Link to this post

    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

    1891 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.