UIkitViewList.php in UIkit Components 8.3
File
uikit_views/src/Plugin/views/style/UIkitViewList.php
View source
<?php
namespace Drupal\uikit_views\Plugin\views\style;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\style\StylePluginBase;
class UIkitViewList extends StylePluginBase {
protected $usesRowPlugin = TRUE;
protected function defineOptions() {
$options = parent::defineOptions();
$options['class'] = [
'default' => 'uk-list',
];
$options['wrapper_class'] = [
'default' => 'uikit-view-list',
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$args = [
'@href' => 'https://getuikit.com/docs/list',
'@title' => 'List component - UIkit documentation',
];
$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 modifier to apply to the list. See <a href="@href" target="_blank" title="@title">List component</a> to view examples of each list modifier.', $args),
'#type' => 'select',
'#default_value' => $this->options['class'],
'#options' => [
'default' => $this
->t('Default'),
'uk-list-divider' => $this
->t('List divider'),
'uk-list-striped' => $this
->t('List striped'),
'uk-list-large' => $this
->t('List large'),
],
];
}
}
Classes
Name |
Description |
UIkitViewList |
Style plugin to render each item in a UIkit List component. |