
| Current Path : /var/www/html/rocksensor1/web/core/modules/views/src/Plugin/views/style/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/views/src/Plugin/views/style/HtmlList.php |
<?php
namespace Drupal\views\Plugin\views\style;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Attribute\ViewsStyle;
/**
* Style plugin to render each item in an ordered or unordered list.
*
* @ingroup views_style_plugins
*/
#[ViewsStyle(
id: "html_list",
title: new TranslatableMarkup("HTML List"),
help: new TranslatableMarkup("Displays rows as HTML list."),
theme: "views_view_list",
display_types: ["normal"],
)]
class HtmlList extends StylePluginBase {
/**
* {@inheritdoc}
*/
protected $usesRowPlugin = TRUE;
/**
* Does the style plugin support custom css class for the rows.
*
* @var bool
*/
protected $usesRowClass = TRUE;
/**
* Set default options.
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['type'] = ['default' => 'ul'];
$options['class'] = ['default' => ''];
$options['wrapper_class'] = ['default' => 'item-list'];
return $options;
}
/**
* Render the given style.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['type'] = [
'#type' => 'radios',
'#title' => $this->t('List type'),
'#options' => ['ul' => $this->t('Unordered list'), 'ol' => $this->t('Ordered list')],
'#default_value' => $this->options['type'],
];
$form['wrapper_class'] = [
'#title' => $this->t('Wrapper class'),
'#description' => $this->t('The class to provide on the wrapper, outside the list.'),
'#type' => 'textfield',
'#size' => '30',
'#default_value' => $this->options['wrapper_class'],
];
$form['class'] = [
'#title' => $this->t('List class'),
'#description' => $this->t('The class to provide on the list element itself.'),
'#type' => 'textfield',
'#size' => '30',
'#default_value' => $this->options['class'],
];
}
}