Posts

Showing posts with the label xml-d8 migration

XML-D8 Migration: Extending the migration capabilities by using CUSTOM Process plugin

Image
In our last blog post, XML-D8 Migration: Extending the migration capabilities by using available Process plugins , we have extended the migration capabilities by using already available process plugins. In this blog post, we will extend the capabilities of that migration by writing custom Process plugins. In this blog post, we will map the content to different content types based on the 'site url' field in XML. There are no changes in XML file and we are using the same XML file which was used in earlier blog posts. To use the custom plugin, we need to specify the plugin name in our .yml file under config/install, so we have made that one change which looks below, Basically we are telling the migration API that for 'type' field use 'content_type_plugin' and 'site_url' XML field will be used as source. Next we have created the custom process plugin in src/Plugin/migrate/process/ContentTypePlugin.php . This custom process plugin uses 's...

XML-D8 Migration: Extending the migration capabilities by using available Process plugins

Image
In our last blog post, XML-D8 Migration: Very basic migration by just using YML file , we have done very basic XML to Drupal 8 migration. In this blog post, we will extend the capabilities of that migration by using available Process plugins . To add-on, we have added new fields like city, state, site url, site name, keywords, creation date to the XML file and now it looks like below, We will be migrating city and state fields into place field in D8 by using concat process plugin . Site name and site url fields will be migrated to URL field in D8. Creation date field will be migrated to content creation date field in D8 using callback process plugin . Keywords field will be migrated to tags taxonomy field referenced in content type. For tags migration, we will be using explode process plugin and concept of pipeline . We have added the new fields in page content type on D8 site and it looks like below, Next we have added the mapping of these new fields in config/install/...

XML-D8 Migration: Very basic migration by just using YML file

Image
As we are working XML to Drupal 8 migration project, so we just want to explore how the very basic migration looks like! We have written a custom module to define mapping between XML data and Drupal 8 entity. Like any other module in D8, we need .info.yml file which looks like below, In the .info.yml file, we have added dependencies for migrate_plus and migrate_tools modules. Migrate Plus module is required to do migration from sources like XML and JSON. Migrate Tools module provides tools for running and managing Drupal 8 migrations. As we are migration from XML so we have created a sample XML file which contains ID, Title and Body fields. It looks like below, Lastly and most importantly, for this very basic migration, we just needed one .yml file in config/install folder for our migration. This .yml file defines Source (XML file and fields in it), Destination (Drupal entity) and Field mappings (Process plugins). It looks like below, We have placed the source XM...