Drupal-6(D6) to Drupal-8 (D8) CCK Single On/Off Checkbox, Checkboxes fix

Problem

While migrating from drupal6 to drupal8 using dupal migrate module, all Drupal 6 integer, Float, decimal and text fields are converted into integer and text fields.

These new fields in drupal8 doesn’t support checkbox and radio buttons. E.g If you have text checkboxes in drupal 6 and you are going to migrate your site to drupal 8 these values won’t go to drupal 8, because drupal 8 will try to convert these fields to boolean, and its not possile to store “Yes” or any other text in integer fields.

Resolution

This problem could be resolved by field mapping in drupal-8. As you know field mapping in drupal 8 is different as compare to Drupal 7.

How to use field mapping in drupal-8 (D8) ?

field mapping in drupal-8 is very easy. You don’t need to write any php code,you just have to declare or modify mapping in yml file. to do this,
open following file in notepad or text editor

/core/modules/migrate_drupal/config/install/migrate.migration.d6_field.yml

and change field mapping for text( on off button) to “list string. your file will look like this after change

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 map:
        number_integer:
          number: integer
          optionwidgets_select: list_integer
          optionwidgets_buttons: list_integer
          optionwidgets_onoff: list_string
        number_decimal:
          number: decimal
          optionwidgets_select: list_float
          optionwidgets_buttons: list_float
          optionwidgets_onoff: list_string
        number_float:
          number: float
          optionwidgets_select: list_float
          optionwidgets_buttons: list_float
          optionwidgets_onoff: list_string
        text:
          optionwidgets_select: list_string
          optionwidgets_buttons: list_string
          optionwidgets_onoff: list_string
          text_textfield: text
          text_textarea: text_long

After making changes , save the file and enable/install migrate module again and run migration using drush command as mentioned in https://www.codeinsects.com/migrate-drupal-6-to-drupal-8-using-drupal-migrate-module.html

If it doesn’t work, delete your drupal 8 database and reinstall drupal-8, having above file changed and execute migration.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Skip to toolbar