FieldType.php in Zircon Profile 8
File
core/modules/field/src/Plugin/migrate/process/d6/FieldType.php
View source
<?php
namespace Drupal\field\Plugin\migrate\process\d6;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\migrate\process\StaticMap;
use Drupal\migrate\Row;
use Symfony\Component\DependencyInjection\ContainerInterface;
class FieldType extends StaticMap implements ContainerFactoryPluginInterface {
protected $cckPluginManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, PluginManagerInterface $cck_plugin_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->cckPluginManager = $cck_plugin_manager;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('plugin.manager.migrate.cckfield'));
}
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
list($field_type, $widget_type) = $value;
try {
return $this->cckPluginManager
->createInstance($field_type)
->getFieldType($row);
} catch (PluginNotFoundException $e) {
return parent::transform($value, $migrate_executable, $row, $destination_property);
}
}
}
Classes
Name |
Description |
FieldType |
Plugin annotation
@MigrateProcessPlugin(
id = "field_type"
) |