function UserNameFormatter::settingsForm

Same name and namespace in other branches
  1. 8.9.x core/modules/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php \Drupal\user\Plugin\Field\FieldFormatter\UserNameFormatter::settingsForm()
  2. 10 core/modules/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php \Drupal\user\Plugin\Field\FieldFormatter\UserNameFormatter::settingsForm()
  3. 11.x core/modules/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php \Drupal\user\Plugin\Field\FieldFormatter\UserNameFormatter::settingsForm()

Overrides FormatterBase::settingsForm

File

core/modules/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php, line 37

Class

UserNameFormatter
Plugin implementation of the 'user_name' formatter.

Namespace

Drupal\user\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    $form['link_to_entity'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Link to the user'),
        '#default_value' => $this->getSetting('link_to_entity'),
    ];
    return $form;
}

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