ViewsBootstrapTable.php in Views Bootstrap 8.4
File
src/Plugin/views/style/ViewsBootstrapTable.php
View source
<?php
namespace Drupal\views_bootstrap\Plugin\views\style;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\style\Table;
class ViewsBootstrapTable extends Table {
protected function defineOptions() {
$options = parent::defineOptions();
$options['bootstrap_styles'] = [
'default' => [],
];
$options['responsive'] = [
'default' => FALSE,
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['responsive'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Responsive'),
'#default_value' => $this->options['responsive'],
'#description' => $this
->t('To make a table scroll horizontally on small devices.'),
];
$form['bootstrap_styles'] = [
'#title' => $this
->t('Bootstrap styles'),
'#type' => 'checkboxes',
'#default_value' => $this->options['bootstrap_styles'],
'#options' => [
'striped' => $this
->t('Striped'),
'bordered' => $this
->t('Bordered'),
'hover' => $this
->t('Hover'),
'condensed' => $this
->t('Condensed'),
],
];
}
}