You are here

ProfileValues.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/user/src/Plugin/migrate/builder/d6/ProfileValues.php

File

core/modules/user/src/Plugin/migrate/builder/d6/ProfileValues.php
View source
<?php

/**
 * @file
 * Contains \Drupal\user\Plugin\migrate\builder\d6\ProfileValues.
 */
namespace Drupal\user\Plugin\migrate\builder\d6;

use Drupal\migrate\Entity\Migration;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\Plugin\migrate\builder\BuilderBase;

/**
 * @PluginID("d6_profile_values")
 */
class ProfileValues extends BuilderBase {

  /**
   * {@inheritdoc}
   */
  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,
    ];
  }

}

Classes

Namesort descending Description
ProfileValues Plugin annotation @PluginID("d6_profile_values");