Add class to views row instead of replace system classes I have this code:

function theme_preprocess_views_view_unformatted(&amp;$vars) {
  $view = $vars['view'];
  $rows = $vars['rows'];

foreach ($vars['view']-&gt;result as $id =&gt; $row) {

    if (!empty($row-&gt;field_field_image)) {
      $vars['classes_array'][$id] = 'has_field';
    }  
    else {
      $vars['classes_array'][$id] = 'has_no_field';
    }
  }
}


It works, but replaces all system original classes.

How to just add class?
I tried with $vars['classes_array'][$id][] but I'm getting: Fatal error: [] operator not supported for strings
Your question is simply a PHP programming question, and not entirely Drupal related. But here goes:

function theme_preprocess_views_view_unformatted(&amp;$vars) {
  $view = $vars['view'];
  $rows = $vars['rows'];

foreach ($vars['view']-&gt;result as $id =&gt; $row) {

    if (!empty($row-&gt;field_field_image)) {
      $old_class_values = $vars['classes_array'][$id];
      $vars['classes_array'][$id] = $old_class_values . ' has_field';
    }  
    else {
      $vars['classes_array'][$id] = $old_class_values . ' has_no_field';
    }
  }
}