buildSorts example

/** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $style_options = Views::fetchPluginNames('style', 'normal', [$this->base_table]);
    $feed_row_options = Views::fetchPluginNames('row', 'feed', [$this->base_table]);
    $path_prefix = Url::fromRoute('<none>', []['absolute' => TRUE])->toString();

    // Add filters and sorts which apply to the view as a whole.     $this->buildFilters($form$form_state);
    $this->buildSorts($form$form_state);

    $form['displays']['page'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('Page settings'),
      '#attributes' => ['class' => ['views-attachment', 'fieldset-no-legend']],
      '#tree' => TRUE,
    ];
    $form['displays']['page']['create'] = [
      '#title' => $this->t('Create a page'),
      '#type' => 'checkbox',
      '#attributes' => ['class' => ['strong']],
      
Home | Imprint | This part of the site doesn't use cookies.