3 namespace Drupal\views\Plugin\views\style;
5 use Drupal\Core\Form\FormStateInterface;
8 * Style plugin to render each item in an ordered or unordered list.
10 * @ingroup views_style_plugins
14 * title = @Translation("HTML List"),
15 * help = @Translation("Displays rows as HTML list."),
16 * theme = "views_view_list",
17 * display_types = {"normal"}
20 class HtmlList extends StylePluginBase {
23 * Does the style plugin allows to use style plugins.
27 protected $usesRowPlugin = TRUE;
30 * Does the style plugin support custom css class for the rows.
34 protected $usesRowClass = TRUE;
39 protected function defineOptions() {
40 $options = parent::defineOptions();
42 $options['type'] = ['default' => 'ul'];
43 $options['class'] = ['default' => ''];
44 $options['wrapper_class'] = ['default' => 'item-list'];
50 * Render the given style.
52 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
53 parent::buildOptionsForm($form, $form_state);
56 '#title' => $this->t('List type'),
57 '#options' => ['ul' => $this->t('Unordered list'), 'ol' => $this->t('Ordered list')],
58 '#default_value' => $this->options['type'],
60 $form['wrapper_class'] = [
61 '#title' => $this->t('Wrapper class'),
62 '#description' => $this->t('The class to provide on the wrapper, outside the list.'),
63 '#type' => 'textfield',
65 '#default_value' => $this->options['wrapper_class'],
68 '#title' => $this->t('List class'),
69 '#description' => $this->t('The class to provide on the list element itself.'),
70 '#type' => 'textfield',
72 '#default_value' => $this->options['class'],