How to override specific row classes in a view preprocess function Have tried the following but it does not work 

function THEMENAME_preprocess_views_view_unformatted(&amp;$vars){
  $view = $vars['view'];
  if($view-&gt;name == "videos" &amp;&amp; $view-&gt;current_display == "block_2"){
    $vars["rows"][0]["attributes"]["class"] = array_merge($vars["rows"][0]["attributes"]["class"],['testclass']);
  }
}
For Example:



function THEMENAME_preprocess_views_view_unformatted(&amp;$variables) {
  $view = $variables['view'];
  $view_name = $view-&gt;id();

  if ($view_name = 'frontpage') {
    $rows = $variables['rows'];
    foreach ($rows as $id =&gt; $row) {
      if( in_array($id,[0]) ) { //first row only
        $attributes = $variables['rows'][$id]['attributes'];
        $attributes-&gt;removeClass('lol')-&gt;addClass('haha'); // changes "lol" to "haha"
        break;
      }
    }
  }

}