Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 11 |
FieldInstanceDefaults | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 11 |
transform | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 11 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\field\Plugin\migrate\process\d7\FieldInstanceDefaults. | |
*/ | |
namespace Drupal\field\Plugin\migrate\process\d7; | |
use Drupal\migrate\MigrateExecutableInterface; | |
use Drupal\migrate\ProcessPluginBase; | |
use Drupal\migrate\Row; | |
/** | |
* @MigrateProcessPlugin( | |
* id = "d7_field_instance_defaults" | |
* ) | |
*/ | |
class FieldInstanceDefaults extends ProcessPluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { | |
list($default_value, $widget_settings) = $value; | |
$widget_type = $widget_settings['type']; | |
$default = array(); | |
foreach ($default_value as $item) { | |
switch ($widget_type) { | |
// Add special processing here if needed. | |
default: | |
$default[] = $item; | |
} | |
} | |
return $default; | |
} | |
} |