What is wrong with this drupal 7 preprocess function to output a fields value into the body classes? I have the following preprocess function and was wondering what I have wrong here as its not working.

This is just to grab a fields value and insert it into the body classes.

/**
 * Implements hook_preprocess_html().
 */
function cotyhouse_preprocess_html(&amp;$vars){
  $node = menu_get_object('node');

  // Check if on an article node page
  if ($node-&gt;type == 'article') {
    // Get field values
    if (field_get_items('node', $node, 'field_title_color') == 'black') {
      $vars['classes_array'][] = drupal_html_class('tblk');
    }   
    if (field_get_items('node', $node, 'field_title_color') == 'white') {
      $vars['classes_array'][] = drupal_html_class('twhi');
    }   
    if (field_get_items('node', $node, 'field_title_color') == 'white_shadow') {
      $vars['classes_array'][] = drupal_html_class('tsha');
    }   
  }    
}
field_get_items return an array of field item so you need to do something like :

/**
 * Implements hook_preprocess_html().
 */
function cotyhouse_preprocess_html(&amp;$vars){
  $node = menu_get_object('node');

  // Check if on an article node page
  if ($node-&gt;type == 'article') {

    // get field_title_color value
    $color = NULL;
    $field_items = field_get_items('node', $node, 'field_title_color');
    if ($field_items) {
      $first_item = reset($field_items);
      $color = $first_item['value'];
    }

    // Set class corresponding to color
    if ($color == 'black') {
      $vars['classes_array'][] = drupal_html_class('tblk');
    }   
    if ($color == 'white') {
      $vars['classes_array'][] = drupal_html_class('twhi');
    }   
    if ($color == 'white_shadow') {
      $vars['classes_array'][] = drupal_html_class('tsha');
    }   
  }    
}