HtmlList.php in Zircon Profile 8
File
core/modules/views/src/Plugin/views/style/HtmlList.php
View source
<?php
namespace Drupal\views\Plugin\views\style;
use Drupal\Core\Form\FormStateInterface;
class HtmlList extends StylePluginBase {
protected $usesRowPlugin = TRUE;
protected $usesRowClass = TRUE;
protected function defineOptions() {
$options = parent::defineOptions();
$options['type'] = array(
'default' => 'ul',
);
$options['class'] = array(
'default' => '',
);
$options['wrapper_class'] = array(
'default' => 'item-list',
);
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['type'] = array(
'#type' => 'radios',
'#title' => $this
->t('List type'),
'#options' => array(
'ul' => $this
->t('Unordered list'),
'ol' => $this
->t('Ordered list'),
),
'#default_value' => $this->options['type'],
);
$form['wrapper_class'] = array(
'#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'] = array(
'#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'],
);
}
}
Classes
Name |
Description |
HtmlList |
Style plugin to render each item in an ordered or unordered list. |