You are here

class CckMigration in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate_drupal/src/Plugin/migrate/builder/d6/CckMigration.php \Drupal\migrate_drupal\Plugin\migrate\builder\d6\CckMigration

Plugin annotation

@PluginID("d6_cck_migration");

Hierarchy

Expanded class hierarchy of CckMigration

File

core/modules/migrate_drupal/src/Plugin/migrate/builder/d6/CckMigration.php, line 18
Contains \Drupal\migrate_drupal\Plugin\migrate\builder\d6\CckMigration.

Namespace

Drupal\migrate_drupal\Plugin\migrate\builder\d6
View source
class CckMigration extends CckBuilder {

  /**
   * List of cckfield plugin IDs which have already run.
   *
   * @var string[]
   */
  protected $processedFieldTypes = [];

  /**
   * {@inheritdoc}
   */
  public function buildMigrations(array $template) {
    $migration = Migration::create($template);
    $source_plugin = $migration
      ->getSourcePlugin();

    // The source plugin will throw RequirementsException if CCK is not enabled,
    // in which case there is nothing else for us to do.
    if ($source_plugin instanceof RequirementsInterface) {
      try {
        $source_plugin
          ->checkRequirements();
      } catch (RequirementsException $e) {
        return [
          $migration,
        ];
      }
    }

    // Loop through every field that will be migrated.
    foreach ($source_plugin as $field) {
      $field_type = $field
        ->getSourceProperty('type');

      // Each field type should only be processed once.
      if (in_array($field_type, $this->processedFieldTypes)) {
        continue;
      }
      elseif ($this->cckPluginManager
        ->hasDefinition($field_type)) {
        $this->processedFieldTypes[] = $field_type;

        // Allow the cckfield plugin to alter the migration as necessary so that
        // it knows how to handle fields of this type.
        $this->cckPluginManager
          ->createInstance($field_type, [], $migration)
          ->{$this->configuration['cck_plugin_method']}($migration);
      }
    }
    return [
      $migration,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BuilderBase::getSourcePlugin protected function Returns a fully initialized instance of a source plugin.
CckBuilder::$cckPluginCache protected property Already-instantiated cckfield plugins, keyed by ID.
CckBuilder::$cckPluginManager protected property The cckfield plugin manager.
CckBuilder::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
CckBuilder::getCckPlugin protected function Gets a cckfield plugin instance.
CckBuilder::__construct public function Constructs a CckBuilder. Overrides PluginBase::__construct
CckMigration::$processedFieldTypes protected property List of cckfield plugin IDs which have already run.
CckMigration::buildMigrations public function Builds migration entities based on a template. Overrides MigrateBuilderInterface::buildMigrations
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
PluginBase::$configuration protected property Configuration information passed into the plugin. 2
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
StringTranslationTrait::$stringTranslation protected property The string translation service.
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.