Load a specific CSS file for RTL languages

Public

Sometimes, you need to update a existing theme to fit with rtl languages, and maybe you don't want, or can't review all your CSS and just prefer override only what is needed... so this is for you

Get raw version
php
  1. /**
  2.  * Implementation of template_preprocess_html().
  3.  */
  4. function mytheme_preprocess_html(&$variables) {
  5. global $language;
  6. if (isset($language->dir) && $language->dir == 'rtl') {
  7. drupal_add_css(drupal_get_path('theme', 'mytheme') . '/css/rtl.css', array('group' => CSS_THEME, 'every_page' => TRUE));
  8. }
  9. }