shortcutSetStorage = $shortcut_set_storage; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { return new static( $configuration, $plugin_id, $plugin_definition, $migration, $container->get('entity.manager')->getStorage('shortcut_set') ); } /** * {@inheritdoc} */ public function getIds() { return [ 'set_name' => [ 'type' => 'string', ], 'uid' => [ 'type' => 'integer', ], ]; } /** * {@inheritdoc} */ public function fields(MigrationInterface $migration = NULL) { return [ 'uid' => 'The users.uid for this set.', 'source' => 'The shortcut_set.set_name that will be displayed for this user.', ]; } /** * {@inheritdoc} */ 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()]; } }