1

I have run migration using drush migrate-upgrade by setting up Drupal 7 used module in Drupal 8 site and DB path etc. But one of my content type use field https://www.drupal.org/project/url but now link field is in Drupa 8 and version of this module is not available in Drupal 8.

In support I have gone thorugh https://www.drupal.org/project/url/issues/1778224 but didn't helped much.

How I can transfer data along with revisions data related to this field and create/migrate similar field in Drupal 8 content type (rest of fields got migrated in 8 from 7)?

  • 1
    Possible duplicate of Migrating link fields to Drupal 8 – Shawn Conn Feb 27 '18 at 8:35
  • yes it seems smilier but I need help for related explanation ie: is that possible to migrate without custom solution. Or there is need to create some custom solution to migrate such data, if so any tutorial links or explanation will be helpful. – jas Feb 27 '18 at 8:39
  • Drupal Answers is not a tutorial service, it's a Q&A knowledge base. Use google to find tutorials. There is plenty of documentation out there on using the migration framework to convert link field data. – Shawn Conn Feb 27 '18 at 8:45
1

Have to create solution based on https://www.drupal.org/docs/8/api/migrate-api/writing-migrations-for-contributed-and-custom-modules#field-migrations

enter image description here

<?php

namespace Drupal\custom_url_migrate\plugin\migrate\field;

use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;

/**
 * @MigrateField(
 * id = "url",
 * core = {7},
 * type_map = {
 * "url" = "link"
 * },
 * source_module = "url",
 * destination_module = "link"
 * )
 */
class url extends FieldPluginBase {

  /**
   * {@inheritdoc}
   */
  public function getFieldWidgetMap() {
    return [
      'url' => 'link',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldFormatterMap() {
    return [
     //'default' => 'link',
      //'url' => 'link',
      'url_external' => 'link',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
    $process = [
      'plugin' => 'sub_process',
      'source' => $field_name,
      'process' => [
        'uri' => 'value',
      ],
    ];
    $migration->setProcessOfProperty($field_name, $process);
  }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.