You are here

public function DraggableViews::import in DraggableViews 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/migrate/destination/DraggableViews.php \Drupal\draggableviews\Plugin\migrate\destination\DraggableViews::import()

Import the row.

Derived classes must implement import(), to construct one new object (pre-populated) using ID mappings in the Migration.

Parameters

\Drupal\migrate\Row $row: The row object.

array $old_destination_id_values: (optional) The old destination IDs. Defaults to an empty array.

Return value

array|bool An indexed array of destination IDs in the same order as defined in the plugin's getIds() method if the plugin wants to save the IDs to the ID map, TRUE to indicate success without saving IDs to the ID map, or FALSE to indicate a failure.

Overrides MigrateDestinationInterface::import

File

src/Plugin/migrate/destination/DraggableViews.php, line 22

Class

DraggableViews
Defines destination plugin for Draggableviews.

Namespace

Drupal\draggableviews\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = []) {
  $record = [
    'view_name' => $row
      ->getDestinationProperty('view_name'),
    'view_display' => $row
      ->getDestinationProperty('view_display'),
    'args' => $row
      ->getDestinationProperty('args'),
    'entity_id' => $row
      ->getDestinationProperty('entity_id'),
    'weight' => $row
      ->getDestinationProperty('weight'),
    'parent' => $row
      ->getDestinationProperty('parent'),
  ];
  $result = Database::getConnection()
    ->insert('draggableviews_structure')
    ->fields($record)
    ->execute();
  return [
    $result,
  ];
}