You are here

public function UserData::buildOptionsForm in Drupal 10

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

File

core/modules/user/src/Plugin/views/field/UserData.php, line 69

Class

UserData
Provides access to the user data service.

Namespace

Drupal\user\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $modules = $this->moduleHandler
    ->getModuleList();
  $names = [];
  foreach (array_keys($modules) as $name) {
    $names[$name] = $this->moduleHandler
      ->getName($name);
  }
  $form['data_module'] = [
    '#title' => $this
      ->t('Module name'),
    '#type' => 'select',
    '#description' => $this
      ->t('The module which sets this user data.'),
    '#default_value' => $this->options['data_module'],
    '#options' => $names,
  ];
  $form['data_name'] = [
    '#title' => $this
      ->t('Name'),
    '#type' => 'textfield',
    '#description' => $this
      ->t('The name of the data key.'),
    '#default_value' => $this->options['data_name'],
  ];
}