use Drupal\Core\Template\Attribute;

/**
 * Prepares variables for views-style-{{ plugin_id|u2h }}.html.twig template.
 */
function template_preprocess_views_style_{{ plugin_id }}(&$variables) {

  $view = $variables['view'];
  $options = $view->style_plugin->options;

{% if configurable %}
  // Fetch wrapper classes from handler options.
  if ($options['wrapper_class']) {
    $variables['attributes']['class'] = explode(' ', $options['wrapper_class']);
  }

{% endif %}
  $variables['default_row_class'] = $options['default_row_class'];
  foreach ($variables['rows'] as $id => $row) {
    $variables['rows'][$id] = [];
    $variables['rows'][$id]['content'] = $row;
    $variables['rows'][$id]['attributes'] = new Attribute();
    if ($row_class = $view->style_plugin->getRowClass($id)) {
      $variables['rows'][$id]['attributes']->addClass($row_class);
    }
  }
}
