I customized tb_rave for my needs but i have problem
now none of the styles with -rtl.css post fix included
can you guide me to the place that this happens, I know that TB Nucleus doesn't support rtl

Comments

ctyar’s picture

I investigated a little more and find out the problem is in
nucleus_css_alter fucntion, each one of these two function calls can cause this problem

$css = drupal_add_css($path, array(
    'group' => CSS_SYSTEM,
    'every_page' => TRUE,
    'weight' => 0,
  ));

and

nucleus_add_conditional_styles($css);

any idea how I can solve this problem?

RKS’s picture

Status: Active » Closed (won't fix)
RKS’s picture

Issue summary: View changes

just a typo

khezer’s picture

Change the nucleus_css_alter function like this

/**
 * Implements hook_css_alter().
 */
function nucleus_css_alter(&$css) {
  $path = drupal_get_path('theme', 'nucleus') . "/css/base.css";
  $css = drupal_add_css($path, array(
    'group' => CSS_SYSTEM,
    'every_page' => TRUE,
    'weight' => 0,
  ));

  foreach ($css as $key => &$value) {
    if ($key == $path) {
      $value['weight'] = 0;
    }
    else {
      $value['weight'] += 0.001;
    }
  }
  nucleus_add_conditional_styles($css);

  global $theme_key;
  $skin = theme_get_setting('skin');
  if (isset($_COOKIE['nucleus_skin'])) {
	$skin = $_COOKIE['nucleus_skin'] == 'default' ? '' : $_COOKIE['nucleus_skin'];
  }  
  if (!empty($skin) && file_exists(drupal_get_path('theme', $theme_key) . "/skins/" . $skin . "/style.css")) {
    $css = drupal_add_css(drupal_get_path('theme', $theme_key) . "/skins/" . $skin . "/style.css", array(
      'group' => CSS_THEME,
    ));
  }

  ///////////////// FIX Additional -rtl.css part ////////////////////////
  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;
        }
      }
    }
  }
  ///////////////////////////////////////////
}