c26f3b9f1c31192bf7ec9f69367200ce0f3744b1
[yaffs-website] / destination / EntityNodeType.php
1 <?php
2
3 namespace Drupal\node\Plugin\migrate\destination;
4
5 use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;
6 use Drupal\migrate\Row;
7
8 /**
9  * @MigrateDestination(
10  *   id = "entity:node_type"
11  * )
12  */
13 class EntityNodeType extends EntityConfigBase {
14
15   /**
16      * {@inheritdoc}
17      */
18   public function import(Row $row, array $old_destination_id_values = []) {
19     $entity_ids = parent::import($row, $old_destination_id_values);
20     if ($row->getDestinationProperty('create_body')) {
21       $node_type = $this->storage->load(reset($entity_ids));
22       node_add_body_field($node_type, $row->getDestinationProperty('create_body_label'));
23     }
24     return $entity_ids;
25   }
26
27 }