function ProfileFieldValues::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/ d6/ ProfileFieldValues.php, line 63
Class
- ProfileFieldValues
- Drupal 6 profile fields values source.
Namespace
Drupal\user\Plugin\migrate\source\d6Code
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.