Module Development

Write a Custom Source Plugin for Drupal 8, 9, 10, and 11

This tutorial covers writing a custom source plugin that imports data from a MySQL database into Drupal nodes. After completing this tutorial you should understand how to write your own custom source plugin that can:

  • Extract data from an SQL source
  • Describe the various fields in the source data to the Migrate API for mapping
  • Provide unique IDs for each row of imported data

By the end of this tutorial you should be able write a custom source plugin that uses an SQL data store as well as have a foundation for writing source plugins that extract data from any source that PHP can read.