Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2630578-32: Formats duplicated in D6 upgrade
Should we do any mapping of old formats to somewhat equivalent formats in D8?
'filtered_html' (d6/d7) => 'basic_html' (d8)
Comments
Comment #3
heddnMigrations are intended to migrate into an empty system. If a site in installed with minimal profile, the basic would never exist.
Comment #4
drzraf CreditAttribution: drzraf commentedIf the "standard" profile is used, assuming that
... the migration process will certainly duplicate these components (in most use-cases)
Does it mean that the minimal profile is the first choice for people intending to migrate?
Comment #5
heddnWhat I meant to say, is that the default mapping in the template from d6 and d7 to d8 won't be changed. If, however, someone wants to deviate from the default, they can use the static map process plugin. I am marked as won't fix for changing the default mapping. But feel free to change it in your specific situation.
My example of minimal shows that filter names are differently named in different profiles. So to assume anything about their naming assumes to much. Filters are named in d6, d7 and d8 depending on the install profile and later edits from site admins. Making assumptions in that space is going to lead not being correct in several cases. For someone who has done the manual mapping, I've had to weigh all these things. And it isn't simple. So falling back on the default of we do not assume anything seems sane and in line with migrate's normal stance.
Comment #6
drzraf CreditAttribution: drzraf commentedThank you for the clarification.
The approach seems sane to me, as long as writing custom mappings is simple enough and well documented.
Could the 'filtered_html' (d6/d7) => 'basic_html' (d8) mapping appear somewhere as an "example"?
Comment #7
heddnhttps://www.drupal.org/docs/8/api/migrate-api/migrate-process/process-pl...
Comment #8
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedLink in #7 is broken if anyone knows a working one please post it
Comment #9
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedAltered the title to match the request from #6 which is to explain how someone can manually create a format mapping if they want to. This seems like something that people will want to do and could even be an example for the documentation of StaticMap. See also #3061681: Provide the ability to map text formats between source and destination which is more ambitious, and tries to automatically perform this mapping.
I guess that the link in #7 was just a link to the StaticMap class. I am aware that the class exists, but I can't see how/where to use it. There are references to the text format in very many places: many fields on many entity types. Please could we have an explanation of what file to edit at least?
Comment #10
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedOK I have it working. Is there someone we can put this for others who are interested?
A hook to substitute the class
The class itself
Comment #13
AnybodyHi @AdamPS,
we just ran into the same situation and I guess one clarification here could help others who run into the same issue:
What is "d7_text" in
Is it the name of the field or or the migration id or the text format?
Like in #3061681: Provide the ability to map text formats between source and destination I guess it would make a lot of sense to document these kind of static mapping migrations somewhere for such typical cases. I'm aware of HOOK_migration_plugins_alter() and HOOK_migrate_prepare_row() which are very helpful for other cases, but in this case they don't help I guess?
So what we'd like to do is use existing Drupal 8 / 9 formats by map instead of migrating (some of / all) the old ones.
I'm curious if there is a better way to switch out upgrade_dX_filter_format and use the map instead of
in node_complete_XXX migrations, but it doesn't seem to be well abstracted to do that for every field.
If anyone has a good snippet or idea, you're very welcome. I have to think about this.
Perhaps it's even easier to switch the formats after migration with a post-migrate script...
Edit:
Perhaps the strategy might be to replace "upgrade_d6_filter_format" to not import any formats but instead just return the mapping?
Comment #18
jmee CreditAttribution: jmee commentedHere are some examples where the migration definition file has been edited, but I think it would be better to use hook_migration_plugins_alter if you need to apply this change everywhere
In my example, the D7 source site's text formats weren't migrated properly when the site was upgrade to d7, so machine names are in the d6 format.
Node body field:
Term description field:
Or a simple default value also works: