Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / draggableviews / src / Plugin / migrate / destination / DraggableViews.php
1 <?php
2
3 namespace Drupal\draggableviews\Plugin\migrate\destination;
4
5 use Drupal\Core\Database\Database;
6 use Drupal\migrate\Entity\MigrationInterface;
7 use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
8 use Drupal\migrate\Row;
9
10 /**
11  * Defines destination plugin for Draggableviews.
12  *
13  * @MigrateDestination(
14  *   id = "draggableviews"
15  * )
16  */
17 class DraggableViews extends DestinationBase {
18
19   /**
20    * {@inheritdoc}
21    */
22   public function import(Row $row, array $old_destination_id_values = []) {
23     $record = [
24       'view_name' => $row->getDestinationProperty('view_name'),
25       'view_display' => $row->getDestinationProperty('view_display'),
26       'args' => $row->getDestinationProperty('args'),
27       'entity_id' => $row->getDestinationProperty('entity_id'),
28       'weight' => $row->getDestinationProperty('weight'),
29       'parent' => $row->getDestinationProperty('parent'),
30     ];
31     $result = Database::getConnection()->insert('draggableviews_structure')->fields($record)->execute();
32     return [$result];
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function getIds() {
39     return [
40       'dvid' => [
41         'type' => 'integer',
42       ],
43     ];
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   public function fields(MigrationInterface $migration = NULL) {
50     return [
51       'dvid' => $this->t('The primarty identifier'),
52       'view_name' => $this->t('The view name.'),
53       'view_display' => $this->t('The view display.'),
54       'args' => $this->t('The arguments.'),
55       'entity_id' => $this->t('The entity id.'),
56       'weight' => $this->t('The order weight.'),
57       'parent' => $this->t('The parent entity id.'),
58     ];
59   }
60
61 }