function ProfileFieldValues::fields

Same name in other branches
  1. 9 core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldValues.php \Drupal\user\Plugin\migrate\source\d6\ProfileFieldValues::fields()
  2. 8.9.x core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldValues.php \Drupal\user\Plugin\migrate\source\d6\ProfileFieldValues::fields()
  3. 11.x core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldValues.php \Drupal\user\Plugin\migrate\source\d6\ProfileFieldValues::fields()

Overrides MigrateSourceInterface::fields

File

core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldValues.php, line 68

Class

ProfileFieldValues
Drupal 6 profile fields values source from database.

Namespace

Drupal\user\Plugin\migrate\source\d6

Code

public function fields() {
    $fields = [
        'fid' => $this->t('Unique profile field ID.'),
        'uid' => $this->t('The user Id.'),
        'value' => $this->t('The value for this field.'),
    ];
    $query = $this->select('profile_values', 'pv')
        ->fields('pv', [
        'fid',
        'value',
    ]);
    $query->leftJoin('profile_fields', 'pf', '[pf].[fid] = [pv].[fid]');
    $query->fields('pf', [
        'name',
        'title',
    ]);
    $results = $query->execute();
    foreach ($results as $profile) {
        $fields[$profile['name']] = $this->t($profile['title']);
    }
    return $fields;
}

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