Getting up to Speed on Drupal 8 Webinar
Blog postWhen is Drupal 8 coming out? What's going to change in the new version? How do I keep track of it, and most importantly, how am I going to learn what I need to know? These are the questions we're going to answer in a Drupal Association webinar on October 22. Joe Shindelar is going to give an update on where things are with Drupal 8, covering a raft of new features and changes that you'll want to know about. He's going to look at it from different perspectives — as a site-builder, themer, and module developer.
Release Day: Writing a Custom Migration
Blog postThis week we're finally ready to dive in and write our first custom migration with the Migrate module. To get things set up, we need to get our source data, and create the content type in our Drupal site so that we have a destination. Joe walks through grabbing some baseball stats in SQL format for the source, and then building out the content types we'll need for teams and players.
Running your own migration requires a bit of setup and boilerplate code, Drupal needs to know where to find the source data, and the Migrate module needs to be provided with some basic information about our custom code. In this lesson we'll look at setting up Drupal to be able to connect to multiple databases, and then create the skeleton of a simple module which will house our custom migration code and an implementation of hook_migrate_api(). Finally we'll create a base class from which we can begin writing our own custom migrations, and talk about why this is a good way to start organizing our migration.
Before we can write our own custom migration we need to construct the site that we're going to import data into and of course we need some source data to import. In this lesson we'll obtain some source data to work with and configure our Drupal site by installing a couple contributed modules, and creating the content types and fields necessary for our information architecture. During this process we'll also be taking a look at the baseball player and team data that we'll be importing and familiarizing ourselves a bit more with the tables and columns in our source database.
Note: The Lahman database structure has changed since this video was recorded, and the latest files provided by Lahman don't match what is used in the video. When following along with these examples you'll either need to use the 2012 source data, or make a few adjustments to field/table names throughout the source code as you follow along so that they match the current structure of the Lahman data.
Additional resources
In this lesson we're going to write our first custom data migration and start importing some of the player data in to Drupal. The primary concepts covered in this lesson are the creation of a migration class following the pattern necessary for Migrate module to be able to discover our code and then dealing with defining source and destination objects so that the Migrate module will know where to read data from and where to write data to. Finally we'll add a simple single field mapping where we map the player's name to the node.title field allowing us to run the migration for the first time and import some real data.
Additional resources
The Migrate module itself contains some excellent examples of data migrations implementing the various APIs provided by the module and serves as the canonical documentation for how to write a migration. In this lesson we'll take a look at the beer and wine import examples provided with the migrate module as a way to familiarize ourselves with the concepts discussed earlier and to be able to see the code that makes up a basic migration before attempting to write our own. In practice these examples serve as a great starting point and can often times be copy/pasted and adjusted for your own needs.
Additional resources
In this lesson we'll take a look at running migrations via drush rather than via the Migrate module's UI. We'll take a look at the commands provided by the Migrate module and talk about what they do. Then we'll practice running, rolling back, and otherwise interacting with migrations via drush commands. Throughout the lesson we'll learn about some of the functionality you get from running migrations via drush that are not provided by the UI, like the ability to specify a single record to migrate with the --idlist
flag. Finally we'll learn about why in most cases drush is a better tool for running large data migrations because of the limitations imposed on the UI. Pay close attention to this lesson since throughout the remainder of this series we'll be running all of our migrations via drush.
Additional resources
In this lesson we'll take a more in-depth look at the migrate module's UI with a focus on being able to identify and execute custom migrations. For now we'll work with the provided example migrations just so that we have something to work with. Throughout the lesson we'll learn how to run a migration to import it's data into Drupal, rollback a migration that was previously run in order to set a clean slate, and other ways we can interact with a migration via the UI. Then we'll discuss some of the challenges inherit in running migrations via the UI and Drupal's Batch API and how to identify them.
Additional resources
Release Day: Migrate Module Orientation
Blog postThis week, we are continuing our Importing Data With Migrate and Drupal 7 series, by getting oriented with the Migrate module. We take a look at two different ways of working with our migrations, through the UI and by using drush. Then we open up the Migrate example module to get an overview about what files are needed, and the main pieces of code used, to create a migration. This sets us up with a foundation to begin writing our own custom migration next week.
This lesson includes a short presentation that explains the basics terminology and architecture of the migrate module and the components that make up a custom data migration. We'll talk about the Extract / Transform / Load process and how it relates to data migrations, the types of data sources that the migration module can read from, and a little bit about how the code in both the migrate module and our own custom migrations will be organized.
Additional resources
In this lesson we'll cover downloading and installing the Migrate module (version 7.x-2.6) and ensuring that our local environment is ready to be able to run migrations via both the UI and drush. Once that's setup we'll take a high level look at the migrate module's UI and drush commands to familiarize ourselves with the tools that we'll be using throughout the rest of the series. This will also help formalize some of concepts introduced in the previous lesson.
Additional resources
Migrate module project page
migrate-7.x-2.6-rc1 download
Migrate module documentation
Introduction to Drush series
Drupalize.Me Migrate module series code on GitHub
This series is focused on using the Migrate module to import data that exists in various different sources into a Drupal 7 website. The Migrate module provides an extremely flexible and robust framework for accessing data from various sources and importing or migrating that data to Drupal. With built in support for creating core Drupal data types likes nodes, users, and taxonomy terms, the Migrate module is one of the best solutions available for importing content into Drupal.
This series kicks off with Joe Shindelar explaining the basic components that make up a data migration, and the terminology and code that is specific to the Migrate module. Then continues with a series of lessons that take you from installing the Migrate module to writing and running your own custom data migration.
Throughout the series Joe teaches us how to run a data migration using both the Migrate module's UI and drush, and some of the plusses and minuses of both methods. Joe also talks about the various different sources, or types of data, from which the Migrate module can read data and how to map the unique fields in a row of source data to their corresponding Drupal content types and fields.
By migrating from a single source into two different Drupal content types we'll also have the opportunity to learn about creating relationships during a migration and mapping the resulting information to an entity reference field. During the course of writing a custom migration Joe will show us how and where we can add code to perform additional runtime data munging during our import process. We'll learn about importing data into multi-value fields, and even providing defaults for fields that don't have information. Then we'll look at some of the tools the migrate module provides for collaborating with team members in order to create a successful migration path.
Finally we'll wrap up the series by looking at a couple of different techniques for debugging our migrations and dealing with pesky source material that just doesn't want to be imported.
Because this series is focused primarily on writing custom data migrations, and since the Migrate module itself requires at least some amount of code to be written to perform a migration, it is suggested that students be familiar with PHP and basic Object Oriented Programming techniques. Although not required to run a migration, Joe uses the drush command line tool extensively in this series. If you need a refresher on using drush take a moment to watch our drush series.
Additional resources
With so much data in so many places on the web, more and more site builders find that they need to get external data into their Drupal sites. It's a common problem with many ways to solve. One of the best ways to tackle this in Drupal is to use the Migrate module. The new Importing Data With Migrate and Drupal 7 series will teach you how to use the Migrate module to take data that exists in different source locations and import that into a Drupal 7 website.
This series taught you how to use two of Drupal’s fundamental “building block” modules: Field and Views. These modules constitute the cornerstone of Drupal’s power and are used extensively throughout the rest of the Using Drupal series. In this summary we'll take a tour the Epic University site we've built to discuss how we built it. We'll wrap things up with a review of the modules and resources we've covered in this series.
Additional resources
The basic job website that we’ve built only touches on the surface of the capability of Field and Views. There are a lot of possibilities for extending the functionality of this job site by adding more fields to both the Job and Job Application content types. In this lesson we'll review some other modules to explore:
- Automatic Node Titles
- Node Reference URL Widget
- Content Access
- Field Permissions
Additional resources
Today we are going to wrap things up on the Using Drupal Chapter 3: Job Board series. We've created a site that meets the Epic University requirements, and learned the fundamental building blocks of putting together a Drupal site. In our last two lessons we are going to look at modules we could use to make our site even better, and then we are going to do our final tour and review of the site we've built, looking at what we've done, and how we built it.
In Episode 25 of the Drupalize.Me Podcast, Kyle Hofmeyer takes time to gather some Lullabots to discuss "developer workflow".
With our basic Applications view built, we have our default display. We also need another faculty display on the site. This second list will be largely the same as the default list, but it needs to show up as a tab on a job posting node, and only list the applications which relate to that particular job. We're going to need to create a new display, and override certain settings, plus add in a contextual filter, in order to get this view completed.
Additional resources
In this lesson we tackle the last display we need for our Applications view, by building a block for our applicants. This has us creating a new type of display, a block, as well as continuing to work with overrides. We also have to change the permissions on this particular display so regular users can see it, but at the same time we only want the view to show a user their own applications.