You are here

public function ProfileValues::buildMigrations in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/migrate/builder/d6/ProfileValues.php \Drupal\user\Plugin\migrate\builder\d6\ProfileValues::buildMigrations()

Builds migration entities based on a template.

Parameters

array $template: The parsed template.

Return value

\Drupal\migrate\Entity\MigrationInterface[] The unsaved migrations generated from the template.

Overrides MigrateBuilderInterface::buildMigrations

File

core/modules/user/src/Plugin/migrate/builder/d6/ProfileValues.php, line 22
Contains \Drupal\user\Plugin\migrate\builder\d6\ProfileValues.

Class

ProfileValues
Plugin annotation @PluginID("d6_profile_values");

Namespace

Drupal\user\Plugin\migrate\builder\d6

Code

public function buildMigrations(array $template) {
  $migration = Migration::create($template);

  // @TODO The source plugin should accept a database connection.
  // @see https://www.drupal.org/node/2552791
  $source_plugin = $this
    ->getSourcePlugin('profile_field', $template['source']);
  try {
    $source_plugin
      ->checkRequirements();
  } catch (RequirementsException $e) {
    return [];
  }
  foreach ($source_plugin as $field) {
    $migration
      ->setProcessOfProperty($field
      ->getSourceProperty('name'), $field
      ->getSourceProperty('name'));
  }
  return [
    $migration,
  ];
}