function ContactLink::buildOptionsForm

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

Overrides LinkBase::buildOptionsForm

File

core/modules/contact/src/Plugin/views/field/ContactLink.php, line 22

Class

ContactLink
Defines a field that links to the user contact page, if access is permitted.

Namespace

Drupal\contact\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['text']['#title'] = $this->t('Link label');
    $form['text']['#required'] = TRUE;
    $form['text']['#default_value'] = empty($this->options['text']) ? $this->getDefaultLabel() : $this->options['text'];
}

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