Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UserData.php

function UserData::buildOptionsForm

Overrides FieldPluginBase::buildOptionsForm

File

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

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal