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 {
25 protected $usesRowPlugin = TRUE;
28 * Does the style plugin support custom css class for the rows.
32 protected $usesRowClass = TRUE;
37 protected function defineOptions() {
38 $options = parent::defineOptions();
40 $options['type'] = ['default' => 'ul'];
41 $options['class'] = ['default' => ''];
42 $options['wrapper_class'] = ['default' => 'item-list'];
48 * Render the given style.
50 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
51 parent::buildOptionsForm($form, $form_state);
54 '#title' => $this->t('List type'),
55 '#options' => ['ul' => $this->t('Unordered list'), 'ol' => $this->t('Ordered list')],
56 '#default_value' => $this->options['type'],
58 $form['wrapper_class'] = [
59 '#title' => $this->t('Wrapper class'),
60 '#description' => $this->t('The class to provide on the wrapper, outside the list.'),
61 '#type' => 'textfield',
63 '#default_value' => $this->options['wrapper_class'],
66 '#title' => $this->t('List class'),
67 '#description' => $this->t('The class to provide on the list element itself.'),
68 '#type' => 'textfield',
70 '#default_value' => $this->options['class'],