8a7267d2352bbdab61ccfbdb71febc37027caf12
[yaffs-website] / web / core / modules / field / src / Plugin / migrate / process / d7 / FieldTypeDefaults.php
1 <?php
2
3 namespace Drupal\field\Plugin\migrate\process\d7;
4
5 use Drupal\migrate\ProcessPluginBase;
6 use Drupal\migrate\MigrateExecutableInterface;
7 use Drupal\migrate\Row;
8
9 /**
10  * Gives us a chance to set per field defaults.
11  *
12  * @MigrateProcessPlugin(
13  *   id = "d7_field_type_defaults"
14  * )
15  */
16 class FieldTypeDefaults extends ProcessPluginBase {
17
18   /**
19    * {@inheritdoc}
20    */
21   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
22     if (is_array($value) && isset($value[1])) {
23       return $value[1];
24     }
25     return $value;
26   }
27
28 }