TagadelicList.php in Tagadelic 8.3
File
src/Plugin/views/style/TagadelicList.php
View source
<?php
namespace Drupal\tagadelic\Plugin\views\style;
use Drupal\core\form\FormStateInterface;
use Drupal\views\Plugin\views\style\StylePluginBase;
class TagadelicList extends StylePluginBase {
protected $usesFields = TRUE;
protected $usesRowPlugin = TRUE;
protected $usesRowClass = TRUE;
protected $defaultFieldLabels = TRUE;
protected function defineOptions() {
$options = parent::defineOptions();
$options['path'] = 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;
$handlers = $this->displayHandler
->getHandlers('field');
if (empty($handlers)) {
$form['error_markup'] = array(
'#markup' => '<div class="messages messages--error">' . $this
->t('You need at least one field before you can configure your table settings') . '</div>',
);
return;
}
$form['count_field'] = array(
'#type' => 'select',
'#title' => $this
->t('Count field'),
'#description' => $this
->t('The field that will be used to caculate the text size.'),
'#options' => $options,
'#default_value' => $this->options['count_field'],
);
}
}