function Links::buildOptionsForm

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/Links.php \Drupal\views\Plugin\views\field\Links::buildOptionsForm()
  2. 8.9.x core/modules/views/src/Plugin/views/field/Links.php \Drupal\views\Plugin\views\field\Links::buildOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/field/Links.php \Drupal\views\Plugin\views\field\Links::buildOptionsForm()

Overrides FieldPluginBase::buildOptionsForm

File

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

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'],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.