You are here

public function DraggableViewsSort::buildOptionsForm in DraggableViews 2.0.x

Basic options for all sort criteria.

Overrides SortPluginBase::buildOptionsForm

File

src/Plugin/views/sort/DraggableViewsSort.php, line 38

Class

DraggableViewsSort
Basic sort handler for Draggableviews Weight.

Namespace

Drupal\draggableviews\Plugin\views\sort

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $view_options = $this
    ->getViewSortDataOptions();
  $form['draggable_views_reference'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Draggable Views Data'),
    '#options' => $view_options,
    '#description' => $this
      ->t('Draggable Views Data to sort on.'),
    '#default_value' => $this->options['draggable_views_reference'],
    '#weight' => -1,
  ];
  $form['draggable_views_null_order'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('NULL Value Order'),
    '#options' => [
      'before' => "Before",
      'after' => "After",
    ],
    '#description' => $this
      ->t('If an entity does not currently belong in the list, should it be added to the list at the begining or the end.'),
    '#default_value' => $this->options['draggable_views_null_order'],
    '#weight' => -1,
  ];
  $form['draggable_views_pass_arguments'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Pass Contextual Filters'),
    '#description' => $this
      ->t('Pass contextual filters from this display to the sort display.'),
    '#default_value' => $this->options['draggable_views_pass_arguments'],
    '#weight' => -1,
  ];
}