function LinkBase::buildOptionsForm

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

Overrides FieldPluginBase::buildOptionsForm

2 calls to LinkBase::buildOptionsForm()
ContactLink::buildOptionsForm in core/modules/contact/src/Plugin/views/field/ContactLink.php
Default options form that provides the label widget that all fields should have.
EntityLink::buildOptionsForm in core/modules/views/src/Plugin/views/field/EntityLink.php
Default options form that provides the label widget that all fields should have.
2 methods override LinkBase::buildOptionsForm()
ContactLink::buildOptionsForm in core/modules/contact/src/Plugin/views/field/ContactLink.php
Default options form that provides the label widget that all fields should have.
EntityLink::buildOptionsForm in core/modules/views/src/Plugin/views/field/EntityLink.php
Default options form that provides the label widget that all fields should have.

File

core/modules/views/src/Plugin/views/field/LinkBase.php, line 143

Class

LinkBase
Field handler to present a link to an entity.

Namespace

Drupal\views\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    $form['text'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Text to display'),
        '#default_value' => $this->options['text'],
    ];
    parent::buildOptionsForm($form, $form_state);
    // The path is set by ::renderLink() so we do not allow to set it.
    $form['alter'] += [
        'path' => [],
        'query' => [],
        'external' => [],
    ];
    $form['alter']['path'] += [
        '#access' => FALSE,
    ];
    $form['alter']['query'] += [
        '#access' => FALSE,
    ];
    $form['alter']['external'] += [
        '#access' => FALSE,
    ];
}

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