5 * Contains destination plugin for Draggable Views database table.
8 namespace Drupal\draggableviews\Plugin\migrate\destination;
10 use Drupal\Core\Database\Database;
11 use Drupal\migrate\Entity\MigrationInterface;
12 use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
13 use Drupal\migrate\Row;
16 * Defines destination plugin for Draggableviews.
18 * @MigrateDestination(
19 * id = "draggableviews"
22 class DraggableViews extends DestinationBase {
25 * Constructs an entity destination plugin.
27 * @param array $configuration
28 * A configuration array containing information about the plugin instance.
29 * @param string $plugin_id
30 * The plugin_id for the plugin instance.
31 * @param mixed $plugin_definition
32 * The plugin implementation definition.
33 * @param MigrationInterface $migration
36 public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
37 parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
43 public function import(Row $row, array $old_destination_id_values = []) {
45 'view_name' => $row->getDestinationProperty('view_name'),
46 'view_display' => $row->getDestinationProperty('view_display'),
47 'args' => $row->getDestinationProperty('args'),
48 'entity_id' => $row->getDestinationProperty('entity_id'),
49 'weight' => $row->getDestinationProperty('weight'),
50 'parent' => $row->getDestinationProperty('parent'),
52 $result = Database::getConnection()->insert('draggableviews_structure')->fields($record)->execute();
53 return array($result);
59 public function getIds() {
70 public function fields(MigrationInterface $migration = NULL) {
72 'dvid' => $this->t('The primarty identifier'),
73 'view_name' => $this->t('The view name.'),
74 'view_display' => $this->t('The view display.'),
75 'args' => $this->t('The arguments.'),
76 'entity_id' => $this->t('The entity id.'),
77 'weight' => $this->t('The order weight.'),
78 'parent' => $this->t('The parent entity id.'),