You are here

public function SortAllowedValues::buildOptionsForm in Views List Sort 8

Options form.

Overrides SortPluginBase::buildOptionsForm

File

src/Plugin/views/sort/SortAllowedValues.php, line 34

Class

SortAllowedValues
Sort handler for fields with allowed_values.

Namespace

Drupal\views_list_sort\Plugin\views\sort

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['allowed_values'] = [
    '#type' => 'radios',
    '#title' => t('Sort by allowed values'),
    '#options' => [
      t('No'),
      t('Yes'),
    ],
    '#default_value' => $this->options['allowed_values'],
  ];
  $form['null_heavy'] = [
    '#type' => 'radios',
    '#title' => t('Treat null values as heavier than the allowed values'),
    '#options' => [
      t('No'),
      t('Yes'),
    ],
    '#default_value' => $this->options['null_heavy'],
  ];
}