views_pre_render add class item to a row When pre-rendering a view row is there a way to add an HTML class into a single row of the markup, allowing me to add a new background colour to the event item highlighting its importance? This is for the calendar module monthly view

For example,

&lt;div class="row"&gt;&lt;/div&gt;
&lt;div class="row this-item-was-added-using-view-views_pre_render"&gt;&lt;/div&gt;
&lt;div class="row"&gt;&lt;/div&gt;


Below the is the what I have so far.

function pnc_views_overrides_views_pre_render(\Drupal\views\ViewExecutable $view)
{
      if ((int)\Drupal::currentUser()-&gt;id() === 1) {
        foreach ($view-&gt;result as $key =&gt; $value) {
          try {
            $field_result_value = $value-&gt;_entity-&gt;field_display-&gt;getValue();
            if (isset($field_result_value[0]) &amp;&amp; (int)$field_result_value[0]['value'] === 1) {
              // add a class to the change the background color to hi-light its importance 
            }
          } catch (Exception $e) {
            \Drupal::logger('viewoveride_pnc_cal_views_overrides')-&gt;error($e-&gt;getMessage());
          }
        }
      }
}
Because you do not want to alter some data, you should use a preprocess function for this. Check this out:

function MYMODULE_preprocess_views_view_unformatted(&amp;$variables) {
  $view = $variables["view"];
  $viewId = $view-&gt;id();
  if($viewId == 'my_view_id'){
    $rows = $variables['rows'];
    foreach ($rows as $id =&gt; $row) {
      $important = $row['content']['#row']-&gt;_entity-&gt;get('field_result_value')-&gt;getString();
      $custom_row_class = 'views-row-' . $important;
      $variables['rows'][$id]['attributes']-&gt;addClass($custom_row_class);
    }
  }
}