You are here

public function Links::buildOptionsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/field/Links.php \Drupal\views\Plugin\views\field\Links::buildOptionsForm()
  2. 9 core/modules/views/src/Plugin/views/field/Links.php \Drupal\views\Plugin\views\field\Links::buildOptionsForm()

File

core/modules/views/src/Plugin/views/field/Links.php, line 38

Class

Links
An abstract handler which provides a collection of links.

Namespace

Drupal\views\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);

  // Only show fields that precede this one.
  $field_options = $this
    ->getPreviousFieldLabels();
  $form['fields'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Fields'),
    '#description' => $this
      ->t('Fields to be included as links.'),
    '#options' => $field_options,
    '#default_value' => $this->options['fields'],
  ];
  $form['destination'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Include destination'),
    '#description' => $this
      ->t('Include a "destination" parameter in the link to return the user to the original view upon completing the link action.'),
    '#default_value' => $this->options['destination'],
  ];
}