/** * {@inheritdoc} * * Set the block plugin id. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (is_array($value)) { list($module, $delta) = $value; switch ($module) { case 'aggregator': list($type, $id) = explode('-', $delta); if ($type == 'feed') { return 'aggregator_feed_block'; } break; case 'menu': return "system_menu_block:{$delta}"; case 'block': if ($this->blockContentStorage) { $block_id = $this->migrationPlugin->transform($delta, $migrate_executable, $row, $destination_property); if ($block_id) { return 'block_content:' . $this->blockContentStorage->load($block_id)->uuid(); } } break; default: break; } } else { return $value; } }
/** * {@inheritdoc} */ public function resolveCurrencyLocale($language_type = LanguageInterface::TYPE_CONTENT) { if (empty($this->currencyLocales[$language_type])) { $currency_locale = NULL; $language_code = $this->languageManager->getCurrentLanguage($language_type)->getId(); // Try this request's country code. $country_code = $this->eventDispatcher->resolveCountryCode(); if ($country_code) { $currency_locale = $this->currencyLocaleStorage->load($language_code . '_' . $country_code); } // Try the site's default country code. if (!$currency_locale) { $country_code = $this->configFactory->get('system.data')->get('country.default'); if ($country_code) { $currency_locale = $this->currencyLocaleStorage->load($language_code . '_' . $country_code); } } // Try the Currency default. if (!$currency_locale) { $currency_locale = $this->currencyLocaleStorage->load($this::DEFAULT_LOCALE); } if ($currency_locale) { $this->currencyLocales[$language_type] = $currency_locale; } else { throw new \RuntimeException(sprintf('The currency locale for %s could not be loaded.', $this::DEFAULT_LOCALE)); } } return $this->currencyLocales[$language_type]; }
/** * {@inheritdoc} * * Set the block plugin id. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (is_array($value)) { list($module, $delta) = $value; switch ($module) { case 'aggregator': list($type, $id) = explode('-', $delta); if ($type == 'category') { // @TODO skip row. // throw new MigrateSkipRowException(); } $value = 'aggregator_feed_block'; break; case 'menu': $value = "system_menu_block:{$delta}"; break; case 'block': if ($this->blockContentStorage) { $block_ids = $this->processPluginManager->createInstance('migration', array('migration' => 'd6_custom_block'), $this->migration)->transform($delta, $migrate_executable, $row, $destination_property); $value = 'block_content:' . $this->blockContentStorage->load($block_ids[0])->uuid(); } else { throw new MigrateSkipRowException(); } break; default: throw new MigrateSkipRowException(); } } return $value; }
/** * {@inheritdoc} */ public function import($currencyCode) { if ($existingEntity = $this->storage->load($currencyCode)) { // Pretend the currency was just imported. return $existingEntity; } $defaultLangcode = $this->languageManager->getDefaultLanguage()->getId(); $currency = $this->externalRepository->get($currencyCode, $defaultLangcode, 'en'); $values = [ 'langcode' => $defaultLangcode, 'currencyCode' => $currency->getCurrencyCode(), 'name' => $currency->getName(), 'numericCode' => $currency->getNumericCode(), 'symbol' => $currency->getSymbol(), 'fractionDigits' => $currency->getFractionDigits(), ]; $entity = $this->storage->create($values); $entity->trustData()->save(); if ($this->languageManager->isMultilingual()) { // Import translations for any additional languages the site has. $languages = $this->languageManager->getLanguages(LanguageInterface::STATE_CONFIGURABLE); $languages = array_diff_key($languages, [$defaultLangcode => $defaultLangcode]); $langcodes = array_map(function ($language) { return $language->getId(); }, $languages); $this->importEntityTranslations($entity, $langcodes); } return $entity; }
/** * {@inheritdoc} */ public function match(AddressInterface $address) { $zone = $this->zoneStorage->load($this->configuration['zone']); if ($zone) { return $zone->match($address); } }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['to']['#markup'] = $this->stateStorage->load($entity->getToState())->label(); $row['label'] = $entity->label(); $row['roles']['#markup'] = implode(', ', user_role_names(FALSE, 'use ' . $entity->id() . ' transition')); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} * * Find the parent link GUID. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { $parent_id = array_shift($value); if (!$parent_id) { // Top level item. return ''; } try { $already_migrated_id = $this->migrationPlugin->transform($parent_id, $migrate_executable, $row, $destination_property); if ($already_migrated_id && ($link = $this->menuLinkStorage->load($already_migrated_id))) { return $link->getPluginId(); } } catch (MigrateSkipRowException $e) { } if (isset($value[1])) { list($menu_name, $parent_link_path) = $value; $url = Url::fromUserInput("/{$parent_link_path}"); if ($url->isRouted()) { $links = $this->menuLinkManager->loadLinksByRoute($url->getRouteName(), $url->getRouteParameters(), $menu_name); if (count($links) == 1) { /** @var \Drupal\Core\Menu\MenuLinkInterface $link */ $link = reset($links); return $link->getPluginId(); } } } throw new MigrateSkipRowException(); }
/** * Checks if a node's type requires a redirect. * * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The event to process. */ public function purlCheckNodeContext(GetResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher_interface) { $route_options = $this->routeMatch->getRouteObject()->getOptions(); $isAdminRoute = array_key_exists('_admin_route', $route_options) && $route_options['_admin_route']; if (!$isAdminRoute && ($matched = $this->matchedModifiers->getMatched() && ($entity = $this->routeMatch->getParameter('node')))) { $node_type = $this->entityStorage->load($entity->bundle()); $purl_settings = $node_type->getThirdPartySettings('purl'); if (!isset($purl_settings['keep_context']) || !$purl_settings['keep_context']) { $url = \Drupal\Core\Url::fromRoute($this->routeMatch->getRouteName(), $this->routeMatch->getRawParameters()->all(), ['host' => Settings::get('purl_base_domain'), 'absolute' => TRUE]); try { $redirect_response = new TrustedRedirectResponse($url->toString()); $redirect_response->getCacheableMetadata()->setCacheMaxAge(0); $modifiers = $event->getRequest()->attributes->get('purl.matched_modifiers', []); $new_event = new ExitedContextEvent($event->getRequest(), $redirect_response, $this->routeMatch, $modifiers); $dispatcher_interface->dispatch(PurlEvents::EXITED_CONTEXT, $new_event); $event->setResponse($new_event->getResponse()); return; } catch (RedirectLoopException $e) { \Drupal::logger('redirect')->warning($e->getMessage()); $response = new Response(); $response->setStatusCode(503); $response->setContent('Service unavailable'); $event->setResponse($response); return; } } } }
/** * {@inheritdoc} */ public function render($empty = FALSE) { if (!empty($this->options['view_to_insert'])) { list($view_name, $display_id) = explode(':', $this->options['view_to_insert']); $view = $this->viewStorage->load($view_name)->getExecutable(); if (empty($view) || !$view->access($display_id)) { return array(); } $view->setDisplay($display_id); // Avoid recursion $view->parent_views += $this->view->parent_views; $view->parent_views[] = "{$view_name}:{$display_id}"; // Check if the view is part of the parent views of this view $search = "{$view_name}:{$display_id}"; if (in_array($search, $this->view->parent_views)) { drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error'); } else { if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) { $output = $view->preview($display_id, $this->view->args); } else { $output = $view->preview($display_id); } $this->isEmpty = $view->display_handler->outputIsEmpty(); return $output; } } return array(); }
/** * Render node type as human readable name, unless using machine_name option. */ function render_name($data, $values) { if ($this->options['machine_name'] != 1 && $data !== NULL && $data !== '') { $type = $this->nodeTypeStorage->load($data); return $type ? $this->t($this->sanitizeValue($type->label())) : ''; } return $this->sanitizeValue($data); }
/** * Imports a single tax type. * * @param \CommerceGuys\Tax\Model\TaxTypeInterface $taxType * The tax type. */ protected function importTaxType(ExternalTaxTypeInterface $taxType) { if ($this->taxTypeStorage->load($taxType->getId())) { return; } $values = ['id' => $taxType->getId(), 'name' => $this->t($taxType->getName()), 'compound' => $taxType->isCompound(), 'displayInclusive' => $taxType->isDisplayInclusive(), 'roundingMode' => $taxType->getRoundingMode(), 'tag' => $taxType->getTag(), 'rates' => array_keys($taxType->getRates())]; return $this->taxTypeStorage->create($values); }
/** * {@inheritdoc} */ public function processItem($data) { /** @var NodeInterface $node */ $node = $this->nodeStorage->load($data->nid); if (!$node->isPublished() && $node instanceof NodeInterface) { return $this->publishNode($node); } }
/** * {@inheritdoc} */ function eventType($entity_type, $bundle) { $ids = $this->eventTypeStorage->getQuery()->condition('entity_type', $entity_type, '=')->condition('bundle', $bundle, '=')->execute(); if ($ids) { return $this->eventTypeStorage->load(reset($ids)); } return NULL; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { /** @var ModerationStateTransitionInterface $entity */ $row['label'] = $entity->label(); $row['id']['#markup'] = $entity->id(); $row['from']['#markup'] = $this->stateStorage->load($entity->getFromState())->label(); $row['to']['#markup'] = $this->stateStorage->load($entity->getToState())->label(); return $row + parent::buildRow($entity); }
/** * Tests Rules default components. */ public function testDefaultComponents() { $config_entity = $this->storage->load('rules_test_default_component'); $user = $this->entityTypeManager->getStorage('user')->create(['mail' => '*****@*****.**']); $config_entity->getComponent()->setContextValue('user', $user)->execute(); // Test that the action was executed correctly. $messages = drupal_get_messages(); $message_string = isset($messages['status'][0]) ? (string) $messages['status'][0] : NULL; $this->assertEquals($message_string, '*****@*****.**'); }
/** * {@inheritdoc} */ public function render(ResultRow $values) { $currency_code = $this->getValue($values); $currency = $this->currencyStorage->load($currency_code); if ($currency) { return call_user_func([$currency, $this->configuration['currency_method']]); } else { return $this->t('Unknuwn currency %currency_code', array('%currency_code' => $currency_code)); } }
/** * {@inheritdoc} */ public function sendMailMessages(MessageInterface $message, AccountInterface $sender) { // Clone the sender, as we make changes to mail and name properties. $sender_cloned = clone $this->userStorage->load($sender->id()); $params = array(); $current_langcode = $this->languageManager->getCurrentLanguage()->getId(); $recipient_langcode = $this->languageManager->getDefaultLanguage()->getId(); $contact_form = $message->getContactForm(); if ($sender_cloned->isAnonymous()) { // At this point, $sender contains an anonymous user, so we need to take // over the submitted form values. $sender_cloned->name = $message->getSenderName(); $sender_cloned->mail = $message->getSenderMail(); // For the email message, clarify that the sender name is not verified; it // could potentially clash with a username on this site. $sender_cloned->name = $this->t('@name (not verified)', array('@name' => $message->getSenderName())); } // Build email parameters. $params['contact_message'] = $message; $params['sender'] = $sender_cloned; if (!$message->isPersonal()) { // Send to the form recipient(s), using the site's default language. $params['contact_form'] = $contact_form; $to = implode(', ', $contact_form->getRecipients()); } elseif ($recipient = $message->getPersonalRecipient()) { // Send to the user in the user's preferred language. $to = $recipient->getEmail(); $recipient_langcode = $recipient->getPreferredLangcode(); $params['recipient'] = $recipient; } else { throw new MailHandlerException('Unable to determine message recipient'); } // Send email to the recipient(s). $key_prefix = $message->isPersonal() ? 'user' : 'page'; $this->mailManager->mail('contact', $key_prefix . '_mail', $to, $recipient_langcode, $params, $sender_cloned->getEmail()); // If requested, send a copy to the user, using the current language. if ($message->copySender()) { $this->mailManager->mail('contact', $key_prefix . '_copy', $sender_cloned->getEmail(), $current_langcode, $params, $sender_cloned->getEmail()); } // If configured, send an auto-reply, using the current language. if (!$message->isPersonal() && $contact_form->getReply()) { // User contact forms do not support an auto-reply message, so this // message always originates from the site. if (!$sender_cloned->getEmail()) { $this->logger->error('Error sending auto-reply, missing sender e-mail address in %contact_form', ['%contact_form' => $contact_form->label()]); } else { $this->mailManager->mail('contact', 'page_autoreply', $sender_cloned->getEmail(), $current_langcode, $params); } } if (!$message->isPersonal()) { $this->logger->notice('%sender-name (@sender-from) sent an email regarding %contact_form.', array('%sender-name' => $sender_cloned->getUsername(), '@sender-from' => $sender_cloned->getEmail(), '%contact_form' => $contact_form->label())); } else { $this->logger->notice('%sender-name (@sender-from) sent %recipient-name an email.', array('%sender-name' => $sender_cloned->getUsername(), '@sender-from' => $sender_cloned->getEmail(), '%recipient-name' => $message->getPersonalRecipient()->getUsername())); } }
/** * Menu callback for linkit search autocompletion. * * Like other autocomplete functions, this function inspects the 'q' query * parameter for the string to use to search for suggestions. * * @param Request $request * The request. * @param $linkit_profile_id * The linkit profile id. * @return JsonResponse * A JSON response containing the autocomplete suggestions. */ public function autocomplete(Request $request, $linkit_profile_id) { $this->linkitProfile = $this->linkitProfileStorage->load($linkit_profile_id); $string = Unicode::strtolower($request->query->get('q')); $matches = $this->resultManager->getResults($this->linkitProfile, $string); $json_object = new \stdClass(); $json_object->matches = $matches; return new JsonResponse($json_object); }
/** * Override the behavior of title(). Get the title of the node. */ function title() { // There might be no valid argument. if ($this->argument) { $term = $this->termStorage->load($this->argument); if (!empty($term)) { return String::checkPlain($term->getName()); } } // TODO review text return $this->t('No name'); }
/** * Make sure that expressions using context definitions can be exported. */ public function testContextDefinitionExport() { $rule = $this->expressionManager->createRule(['context_definitions' => ['test' => ContextDefinition::create('string')->setLabel('Test string')->toArray()]]); $config_entity = $this->storage->create(['id' => 'test_rule'])->setExpression($rule); $config_entity->save(); $loaded_entity = $this->storage->load('test_rule'); // Create the Rules expression object from the configuration. $expression = $loaded_entity->getExpression(); $context_definitions = $expression->getContextDefinitions(); $this->assertEqual($context_definitions['test']->getDataType(), 'string', 'Data type of context definition is correct.'); $this->assertEqual($context_definitions['test']->getLabel(), 'Test string', 'Label of context definition is correct.'); }
/** * {@inheritdoc} */ public function build(RouteMatchInterface $route_match) { $breadcrumb = [Link::createFromRoute($this->t('Home'), '<front>')]; $entity = $route_match->getParameter('entity'); $breadcrumb[] = new Link($entity->label(), $entity->urlInfo()); if (($pid = $route_match->getParameter('pid')) && ($comment = $this->storage->load($pid))) { /** @var \Drupal\comment\CommentInterface $comment */ // Display link to parent comment. // @todo Clean-up permalink in https://www.drupal.org/node/2198041 $breadcrumb[] = new Link($comment->getSubject(), $comment->urlInfo()); } return $breadcrumb; }
/** * Make sure that expressions using context definitions can be exported. */ public function testContextDefinitionExport() { $component = RulesComponent::create($this->expressionManager->createRule())->addContextDefinition('test', ContextDefinition::create('string')->setLabel('Test string')); $config_entity = $this->storage->create(['id' => 'test_rule'])->updateFromComponent($component); $config_entity->save(); $loaded_entity = $this->storage->load('test_rule'); // Create the Rules expression object from the configuration. $expression = $loaded_entity->getExpression(); $this->assertInstanceOf(Rule::class, $expression); $context_definitions = $loaded_entity->getContextDefinitions(); $this->assertEquals($context_definitions['test']->getDataType(), 'string', 'Data type of context definition is correct.'); $this->assertEquals($context_definitions['test']->getLabel(), 'Test string', 'Label of context definition is correct.'); }
/** * Validates the currency code. */ public function validateCurrencyCode(array $element, FormStateInterface &$form_state, array $form) { $currency = $this->getEntity(); $currency_code = $element['#value']; if (!preg_match('/^[A-Z]{3}$/', $currency_code)) { $form_state->setError($element, $this->t('The currency code must consist of three uppercase letters.')); } elseif ($currency->isNew()) { $loaded_currency = $this->storage->load($currency_code); if ($loaded_currency) { $form_state->setError($element, $this->t('The currency code is already in use.')); } } }
/** * Returns a set of route objects. * * @return \Symfony\Component\Routing\RouteCollection * A route collection. */ public function routes() { $collection = new RouteCollection(); //return $collection; foreach ($this->getBrowserIDsWithRoute() as $id) { /** @var $browser \Drupal\entity_browser\EntityBrowserInterface */ $browser = $this->browserStorage->load($id); if ($route = $browser->route()) { $collection->add('entity_browser.' . $browser->id(), $route); } } return $collection; }
/** * {@inheritdoc} */ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) { // We are nesting some sub-elements inside the parent, so we need a wrapper. // We also need to add another #title attribute at the top level for ease in // identifying this item in error messages. We do not want to display this // title because the actual title display is handled at a higher level by // the Field module. $element['#theme_wrappers'][] = 'datetime_wrapper'; $element['#attributes']['class'][] = 'container-inline'; $element['#element_validate'][] = 'datetime_datetime_widget_validate'; // Identify the type of date and time elements to use. switch ($this->getFieldSetting('datetime_type')) { case DateTimeItem::DATETIME_TYPE_DATE: $date_type = 'date'; $time_type = 'none'; $date_format = $this->dateStorage->load('html_date')->getPattern(); $time_format = ''; $element_format = $date_format; $storage_format = DATETIME_DATE_STORAGE_FORMAT; break; default: $date_type = 'date'; $time_type = 'time'; $date_format = $this->dateStorage->load('html_date')->getPattern(); $time_format = $this->dateStorage->load('html_time')->getPattern(); $element_format = $date_format . ' ' . $time_format; $storage_format = DATETIME_DATETIME_STORAGE_FORMAT; break; } $element['value'] = array('#type' => 'datetime', '#default_value' => NULL, '#date_increment' => 1, '#date_date_format' => $date_format, '#date_date_element' => $date_type, '#date_date_callbacks' => array(), '#date_time_format' => $time_format, '#date_time_element' => $time_type, '#date_time_callbacks' => array(), '#date_timezone' => drupal_get_user_timezone(), '#required' => $element['#required']); // Set the storage and widget options so the validation can use them. The // validator will not have access to the field definition. $element['value']['#date_element_format'] = $element_format; $element['value']['#date_storage_format'] = $storage_format; if ($items[$delta]->date) { $date = $items[$delta]->date; // The date was created and verified during field_load(), so it is safe to // use without further inspection. $date->setTimezone(new \DateTimeZone($element['value']['#date_timezone'])); if ($this->getFieldSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE) { // A date without time will pick up the current time, use the default // time. datetime_date_default_time($date); } $element['value']['#default_value'] = $date; } return $element; }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $response = new AjaxResponse(); // Convert any uploaded files from the FID values to data-entity-uuid // attributes and set data-entity-type to 'file'. $fid = $form_state->getValue(array('fid', 0)); if (!empty($fid)) { $file = $this->fileStorage->load($fid); $file_url = file_create_url($file->getFileUri()); // Transform absolute image URLs to relative image URLs: prevent problems // on multisite set-ups and prevent mixed content errors. $file_url = file_url_transform_relative($file_url); $form_state->setValue(array('attributes', 'src'), $file_url); $form_state->setValue(array('attributes', 'data-entity-uuid'), $file->uuid()); $form_state->setValue(array('attributes', 'data-entity-type'), 'file'); } // When the alt attribute is set to two double quotes, transform it to the // empty string: two double quotes signify "empty alt attribute". See above. if (trim($form_state->getValue(array('attributes', 'alt'))) === '""') { $form_state->setValue(array('attributes', 'alt'), ''); } if ($form_state->getErrors()) { unset($form['#prefix'], $form['#suffix']); $form['status_messages'] = ['#type' => 'status_messages', '#weight' => -10]; $response->addCommand(new HtmlCommand('#editor-image-dialog-form', $form)); } else { $response->addCommand(new EditorDialogSave($form_state->getValues())); $response->addCommand(new CloseModalDialogCommand()); } return $response; }
/** * Collects all REST end-points. * * @param \Drupal\Core\Routing\RouteBuildEvent $event * The route build event. */ public function onRouteAlter(RouteBuildEvent $event) { $collection = $event->getRouteCollection(); foreach ($collection->all() as $route_name => $route) { // Rest module endpoint. if (strpos($route_name, 'rest.') === 0) { $this->restRouteNames[$route_name] = $route_name; } // Views module route. if (strpos($route_name, 'view.') === 0 && ($parts = explode('.', $route_name)) && count($parts) == 3) { // We need to introspect the display type. list(, $view_id, $display_id) = $parts; $entity = $this->viewsStorage->load($view_id); if (empty($entity)) { // Non-existent view. continue; } // Build the view. if (empty($this->builtViews[$view_id])) { $this->builtViews[$view_id] = $this->executableFactory->get($entity); $view = $this->builtViews[$view_id]; } else { $view = $this->builtViews[$view_id]; } // Set the given display. $view->setDisplay($display_id); $display = $view->getDisplay(); if ($display instanceof RestExport) { $this->restRouteNames[$route_name] = $route_name; } } } }
/** * Alters base_route and parent_id into the views local tasks. */ public function alterLocalTasks(&$local_tasks) { $view_route_names = $this->state->get('views.view_route_names'); foreach ($this->getApplicableMenuViews() as $pair) { list($view_id, $display_id) = $pair; /** @var $executable \Drupal\views\ViewExecutable */ $executable = $this->viewStorage->load($view_id)->getExecutable(); $executable->setDisplay($display_id); $menu = $executable->display_handler->getOption('menu'); // We already have set the base_route for default tabs. if (in_array($menu['type'], array('tab'))) { $plugin_id = 'view.' . $executable->storage->id() . '.' . $display_id; $view_route_name = $view_route_names[$executable->storage->id() . '.' . $display_id]; // Don't add a local task for views which override existing routes. if ($view_route_name != $plugin_id) { unset($local_tasks[$plugin_id]); continue; } // Find out the parent route. // @todo Find out how to find both the root and parent tab. $path = $executable->display_handler->getPath(); $split = explode('/', $path); array_pop($split); $path = implode('/', $split); $pattern = '/' . str_replace('%', '{}', $path); if ($routes = $this->routeProvider->getRoutesByPattern($pattern)) { foreach ($routes->all() as $name => $route) { $local_tasks['views_view:' . $plugin_id]['base_route'] = $name; // Skip after the first found route. break; } } } } }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $links = array(); $views = Views::getApplicableViews('uses_menu_links'); foreach ($views as $data) { list($view_id, $display_id) = $data; /** @var \Drupal\views\ViewExecutable $executable */ $executable = $this->viewStorage->load($view_id)->getExecutable(); if ($result = $executable->getMenuLinks($display_id)) { foreach ($result as $link_id => $link) { $links[$link_id] = $link + $base_plugin_definition; } } } return $links; }
/** * {@inheritdoc} */ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = NULL) { /** @var \Drupal\migrate\Entity\MigrationInterface $bundle_migration */ $bundle_migration = $storage->load('d6_taxonomy_vocabulary'); $migrate_executable = new MigrateExecutable($bundle_migration, new MigrateMessage()); $process = array_intersect_key($bundle_migration->get('process'), $bundle_migration->getDestinationPlugin()->getIds()); $migrations = array(); $vid_map = array(); foreach ($bundle_migration->getIdMap() as $key => $value) { $old_vid = unserialize($key)['sourceid1']; $new_vid = $value['destid1']; $vid_map[$old_vid] = $new_vid; } foreach ($bundle_migration->getSourcePlugin()->getIterator() as $source_row) { $row = new Row($source_row, $source_row); $migrate_executable->processRow($row, $process); $old_vid = $source_row['vid']; $new_vid = $row->getDestinationProperty('vid'); $vid_map[$old_vid] = $new_vid; } foreach ($vid_map as $old_vid => $new_vid) { $values = $this->migration->toArray(); $migration_id = $this->migration->id() . ':' . $old_vid; $values['id'] = $migration_id; $values['source']['vid'] = $old_vid; $values['process'][$new_vid] = 'tid'; $migrations[$migration_id] = $storage->create($values); } return $migrations; }