You are here

public function ProfileFieldValues::fields in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldValues.php \Drupal\user\Plugin\migrate\source\d6\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 68
Contains \Drupal\user\Plugin\migrate\source\d6\ProfileFieldValues.

Class

ProfileFieldValues
Drupal 6 profile fields values source.

Namespace

Drupal\user\Plugin\migrate\source\d6

Code

public function fields() {
  $fields = array(
    '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', array(
    'fid',
    'value',
  ));
  $query
    ->leftJoin('profile_fields', 'pf', 'pf.fid=pv.fid');
  $query
    ->fields('pf', array(
    'name',
    'title',
  ));
  $results = $query
    ->execute();
  foreach ($results as $profile) {
    $fields[$profile['name']] = $this
      ->t($profile['title']);
  }
  return $fields;
}