function ShortcutSetUsers::import

Same name in other branches
  1. 9 core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers::import()
  2. 8.9.x core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers::import()
  3. 10 core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers::import()

Overrides MigrateDestinationInterface::import

File

core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php, line 86

Class

ShortcutSetUsers
Migration destination for shortcut_set_users.

Namespace

Drupal\shortcut\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = []) {
    
    /** @var \Drupal\shortcut\ShortcutSetInterface $set */
    $set = $this->shortcutSetStorage
        ->load($row->getDestinationProperty('set_name'));
    
    /** @var \Drupal\user\UserInterface $account */
    $account = User::load($row->getDestinationProperty('uid'));
    $this->shortcutSetStorage
        ->assignUser($set, $account);
    return [
        $set->id(),
        $account->id(),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.