You are here : › Pitfall in Drupal 6 to Drupal 8 Migration
May 26, 2016

Pitfall in Drupal 6 to Drupal 8 Migration

1. Node reference

Issue: When the content types are migrated, the node reference field is missing.

Solution: This field which is used in content type, has been removed from Drupal 8. Drupal 8 uses Entity Reference field and so we have to make use of this field instead. We created the field manually and wrote a custom script for migrating the content and kept it in custom module and enabled it.
In custom script,
i). The code retrieves the content from the attribute or column name (of the node field) and the node id (nid) from the content type table of Drupal 6 and use the same nid in Drupal 8 and save the node.
ii). Set the value of the reference field in the corresponding field of the nid (loaded) in Drupal 8.

2. Datestamp and Datetime

Issue: There are three types of Date field in Drupal 6: Date, Datestamp and Datetime. After content migration, we found that these two fields were not migrated.

Solution: We created the field manually and wrote a custom script to solve it. The structure of the script and the way it works is the same as in handling node reference. We just have to get the  field date and nid from the content type table that uses Date field and set it in the corresponding field of content type of Drupal 8 and save the node through script.

3. Taxonomy term field

Issue: In drupal 6, taxonomy term field comes from a contributed module whereas in Drupal 8, it’s available in core. After migration, We found that this field is not migrated too.

Solution: We created the field manually and applied the script to migrate the content.
In script,
i) The code retrieves the contents from the attribute or column names including the image id, name, path and the node id (nid) from the content type table of Drupal 6 and use the same nid in Drupal 8 and save the node..
ii) The path or uri of image is then created as File using File::Create and saved as file. The saved file's File id is set on the image field of taxonomy term field in Drupal 8.

4. Files and images

Issue: Files and images (used in most of the content types)content were not migrated but the field for these contents are migrated successfully.

Solution: We applied a patch for this. Add the patch file in patches directory just under the module directory. Apply the patch with command line.

How to use the patch: Rollback the migration for content types and all entities that use the File and image fields and then Migrate them again.

Link to the patch: https://www.drupal.org/files/issues/2640842­8.patch

5. Youtube video fields

Issue: Embedded Video Field is used in Drupal 6 to embed youtube video URL in the site. The module used in Drupal 6 has not been ported to Drupal 8 during the time the migration.

Solution: We used an alternate module i.e Youtube Video module for this. We created a video field with this module and then applied a script for migrating the content from Drupal 6 to 8. The script code works the same way for youtube field as in doing the node reference field.

Bootstrap theme migration

Issue: Clicking on the parent/main menu which has submenu did not redirect to the proper page.

Solution: We wrote a custom script to find if the menu has class “open”. If yes, we got the “href” of that menu and redirected to that particular “href”.

Snippet

$('li.dropdown').on('click', function() {
          var $el = $(this);
          if ($el.hasClass('open')) {
          var $a = $el.children('a.dropdown­toggle');
                     if ($a.length && $a.attr('href')) {
                              location.href = $a.attr('href');
               }
        }
});
 

 

 

How we can help you?

For a thorough assessment and professional guidance on upgrading your Drupal website, Drupal Geeks can be reached out @ 312-340-7112 or send an email to [email protected]