I’m getting this Notice repeatedly on my Drupal Commerce site, in various places. Not sure though exactly what is triggering the notice. This Notice is:

Notice: Undefined property: stdClass::$dir in omega_css_alter() (line 276 of /home/lovetrib/public_html/sites/all/themes/omega/omega/template.php).

And the line #276 in the Omega template file is

$pattern = $GLOBALS['language']->dir == 'rtl' ? '/\.no-query(-rtl)?\.css$/' : '/\.no-query\.css$/';

I believe it’s looking for a no-query.css file….?

To remedy I put a file named omega.no-query.css in the css folder. Since Omega is a base theme there is also a mytheme.no-query.css file in my theme’s css folder.

Can someone explain precisely what that line is doing and how to fix?

  • Welcome to Drupal Answers! Explaining why $GLOBALS['language']->dir produces that warning is off-topic for us. That is plain PHP. Also, you cannot fix it; it must be the mantainer that fixes the module you are using. – kiamlaluno Oct 31 '15 at 17:56

The $pattern needs to be filled with one of the values to the right of the question mark. To find which value to use, Drupal checks the global variable $GLOBALS['language']->dir if it contains the value 'rtl'. If this is true, the first value is assigned, otherwise the second. Basically this is a short notation of if-else.

The problem is, that $GLOBALS['language']->dir does not exist, so php throws an error.

The lines part should read $GLOBALS['language']->directory There seems to be a fix here, which is from 2014, so there is a good chance this fix was already integrated into production.

You might be able to fix this issue by upgrading the Omega-Template to the latest stable or maybe development version (after creating backups!)

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.