Skip to content
Snippets Groups Projects

Issue #2014471: Drupal 8 version of IP Address Field

Open Issue #2014471: Drupal 8 version of IP Address Field
1 unresolved thread
1 unresolved thread
Files
4
+ 63
0
<?php
namespace Drupal\field_ipaddress\Plugin\migrate\field;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
/**
* @MigrateField(
* id = "field_ipaddress",
* core = {7},
* type_map = {
* "field_ipaddress" = "ipaddress"
* },
* source_module = "field_ipaddress",
* destination_module = "field_ipaddress",
* )
*/
class FieldIpAddress extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'ip_start' => [
'plugin' => 'ipaddress_long_to_binary',
'source' => 'start',
],
'ip_end' => [
'plugin' => 'ipaddress_long_to_binary',
'source' => 'end',
],
],
];
$migration->mergeProcessOfProperty($field_name, $process);
}
/**
* {@inheritdoc}
*/
public function getFieldFormatterMap() {
return [
'field_ipaddress_shorthand' => 'ipaddress_default',
'field_ipaddress_cidr' => 'ipaddress_default',
];
}
/**
* {@inheritdoc}
*/
public function getFieldWidgetMap() {
return [
'field_ipaddress_shorthand' => 'ipaddress_default',
'field_ipaddress_longhand' => 'ipaddress_default',
'field_ipaddress_cidr' => 'ipaddress_default',
];
}
}
Loading