function locale_css_alter

locale_css_alter(&$css)

Implements hook_css_alter().

This function checks all CSS files currently added via drupal_add_css() and and checks to see if a related right to left CSS file should be included.

File

modules/locale/locale.module, line 962
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

function locale_css_alter(&$css) {
  global $language;

  // If the current language is RTL, add the CSS file with the RTL overrides.
  if ($language->direction == LANGUAGE_RTL) {
    foreach ($css as $data => $item) {
      // Only provide RTL overrides for files.
      if ($item['type'] == 'file') {
        $rtl_path = str_replace('.css', '-rtl.css', $item['data']);
        if (file_exists($rtl_path) && !isset($css[$rtl_path])) {
          // Replicate the same item, but with the RTL path and a little larger
          // weight so that it appears directly after the original CSS file.
          $item['data'] = $rtl_path;
          $item['weight'] += 0.0001;
          $css[$rtl_path] = $item;
        }
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!locale!locale.module/function/locale_css_alter/7.x