VerticalTabsStyle.php in Views vertical tabs style plugin 8
File
src/Plugin/views/style/VerticalTabsStyle.php
View source
<?php
namespace Drupal\views_vertical_tabs\Plugin\views\style;
use Drupal\views\Plugin\views\style\StylePluginBase;
use Drupal\Core\Form\FormStateInterface;
class VerticalTabsStyle extends StylePluginBase {
protected $usesRowPlugin = TRUE;
protected $usesRowClass = TRUE;
protected $usesGrouping = FALSE;
protected $usesFields = TRUE;
protected function defineOptions() {
$options = parent::defineOptions();
$options['title'] = array(
'default' => '',
);
$options['description'] = array(
'default' => '',
);
$options['summary'] = array(
'default' => '',
);
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$options = array(
'' => $this
->t('- None -'),
);
$field_labels = $this->displayHandler
->getFieldLabels(TRUE);
$options += $field_labels;
$form['title'] = array(
'#type' => 'select',
'#title' => $this
->t('Tab Title'),
'#options' => $options,
'#default_value' => $this->options['title'],
'#description' => $this
->t('Choose the title of each tab.'),
'#weight' => -49,
);
$form['summary'] = array(
'#type' => 'select',
'#title' => $this
->t('Tab Summary'),
'#options' => $options,
'#default_value' => $this->options['summary'],
'#description' => $this
->t('Optional tab summary.'),
'#weight' => -48,
);
$form['description'] = array(
'#type' => 'select',
'#title' => $this
->t('Fieldset Description'),
'#options' => $options,
'#default_value' => $this->options['description'],
'#description' => $this
->t('Optional tab description.'),
'#weight' => -47,
);
}
}