TreeTable.php in Views tree 8.2
File
src/Plugin/views/style/TreeTable.php
View source
<?php
namespace Drupal\views_tree\Plugin\views\style;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\style\Table;
use Drupal\views_tree\TreeStyleTrait;
class TreeTable extends Table {
use TreeStyleTrait;
protected function defineOptions() {
$options = parent::defineOptions();
$this
->defineCommonOptions($options);
$options['display_hierarchy_column'] = [
'default' => '',
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$this
->getCommonOptionsForm($form, $form_state);
$form['display_hierarchy_column'] = [
'#type' => 'select',
'#title' => $this
->t('Hierarchy display column'),
'#description' => $this
->t('The table column in which to represent the hierarchy. This is typically a title/label field.'),
'#required' => TRUE,
'#options' => $this->displayHandler
->getFieldLabels(),
'#default_value' => $this->options['display_hierarchy_column'],
];
}
}