ColorField.php in Color Field 8.2
File
src/Plugin/migrate/field/ColorField.php
View source
<?php
namespace Drupal\color_field\Plugin\migrate\field;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
class ColorField extends FieldPluginBase {
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'color' => 'rgb',
],
];
$migration
->setProcessOfProperty($field_name, $process);
}
public function getFieldWidgetMap() {
return [
'color_field_default_widget' => 'color_field_widget_box',
'color_field_simple_widget' => 'color_field_widget_grid',
'color_field_spectrum_widget' => 'color_field_widget_html5',
'color_field_plain_text' => 'color_field_widget_default',
];
}
public function getFieldFormatterMap() {
return [
'color_field_default_formatter' => 'color_field_formatter_text',
'color_field_css_declaration' => 'color_field_formatter_css',
'color_field_swatch' => 'color_field_formatter_swatch',
];
}
}