<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\views\style;

{% apply sort_namespaces %}
  {% if configurable %}
use Drupal\Core\Form\FormStateInterface;
  {% endif %}
use Drupal\views\Plugin\views\style\StylePluginBase;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Attribute\ViewsStyle;
{% endapply %}

/**
 * {{ plugin_label }} style plugin.
 */
#[ViewsStyle(
  id: '{{ plugin_id }}',
  title: new TranslatableMarkup('{{ plugin_label }}'),
  help: new TranslatableMarkup('@todo Add help text here.'),
  theme: 'views_style_{{ plugin_id }}',
  display_types: ['normal'],
)]
final class {{ class }} extends StylePluginBase {

  /**
   * {@inheritdoc}
   */
  protected $usesRowPlugin = TRUE;

  /**
   * {@inheritdoc}
   */
  protected $usesRowClass = TRUE;

{% if configurable %}
  /**
   * {@inheritdoc}
   */
  protected function defineOptions(): array {
    $options = parent::defineOptions();
    $options['wrapper_class'] = ['default' => 'item-list'];
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state): void {
    parent::buildOptionsForm($form, $form_state);
    $form['wrapper_class'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Wrapper class'),
      '#description' => $this->t('The class to provide on the wrapper, outside rows.'),
      '#default_value' => $this->options['wrapper_class'],
    ];
  }

{% endif %}
}
