You are here

public function User::fields in Drupal 9

Same name in this branch
  1. 9 core/modules/user/src/Plugin/migrate/source/d6/User.php \Drupal\user\Plugin\migrate\source\d6\User::fields()
  2. 9 core/modules/user/src/Plugin/migrate/source/d7/User.php \Drupal\user\Plugin\migrate\source\d7\User::fields()
Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/migrate/source/d7/User.php \Drupal\user\Plugin\migrate\source\d7\User::fields()

Returns available fields on the source.

Return value

array Available fields in the source, keys are the field machine names as used in field mappings, values are descriptions.

Overrides MigrateSourceInterface::fields

File

core/modules/user/src/Plugin/migrate/source/d7/User.php, line 34

Class

User
Drupal 7 user source from database.

Namespace

Drupal\user\Plugin\migrate\source\d7

Code

public function fields() {
  $fields = [
    'uid' => $this
      ->t('User ID'),
    'name' => $this
      ->t('Username'),
    'pass' => $this
      ->t('Password'),
    'mail' => $this
      ->t('Email address'),
    'signature' => $this
      ->t('Signature'),
    'signature_format' => $this
      ->t('Signature format'),
    'created' => $this
      ->t('Registered timestamp'),
    'access' => $this
      ->t('Last access timestamp'),
    'login' => $this
      ->t('Last login timestamp'),
    'status' => $this
      ->t('Status'),
    'timezone' => $this
      ->t('Timezone'),
    'language' => $this
      ->t('Language'),
    'picture' => $this
      ->t('Picture'),
    'init' => $this
      ->t('Init'),
    'data' => $this
      ->t('User data'),
    'roles' => $this
      ->t('Roles'),
  ];

  // Profile fields.
  if ($this
    ->moduleExists('profile')) {
    $fields += $this
      ->select('profile_fields', 'pf')
      ->fields('pf', [
      'name',
      'title',
    ])
      ->execute()
      ->fetchAllKeyed();
  }
  return $fields;
}