Inject new variables in html.tpl.php based on current node content type I would like to add custom classes and id attribute to html.tpl.php (body tag) based on current viewed content type.

I know i can do like:

 function mytheme_preprocess_html(&amp;$variables) {
            $variables['classes_array'][] = 'myClass';
        }


but how to make it conditional like

           $node = $variables['node'];
        if ($node-&gt;type == 'lighters') {
//assign value to $variables['classes_array'] somehow
}


Also, how can i define new custom_array to inject variable based on content type to body tag ?
Im on Drupal 7.
Thanks!
If I'm reading it right you've pretty much answered your own question there; only caveat being that I'm not sure if $variables['node'] will be set for that particular theme function.

If it's not you can use menu_get_object() to get it:

function mytheme_preprocess_html(&amp;$variables) {
  if ($node = menu_get_object()) {
    if ($node-&gt;type == 'lighters') {
      $variables['classes_array'][] = 'myClass';
    }
  }
}


You can add anything you want to the $variables array and it will be available to you in the template file, as the variable is passed in to the preprocess function by reference. So if you set

$variables['my_var'] = 'something';


you will have access to $my_var, with the value you gave it, in the template file.