Introduction to migration dependencies in Drupal

Submitted by dinarcon on Thu, 08/08/2019 - 22:30

One of Drupal’s biggest strengths is its data modeling capabilities. You can break the information that you need to store into individual fields and group them in content types. You can also take advantage of default behavior provided by entities like nodes, users, taxonomy terms, files, etc. Once the data has been modeled and saved into the system, Drupal will keep track of the relationship between them. Today we will learn about migration dependencies in Drupal.

Migrating files and images into Drupal

Submitted by dinarcon on Wed, 08/07/2019 - 21:00

We have already covered two of many ways to migrate images into Drupal. One example allows you to set the image subfields manually. The other example uses a process plugin that accomplishes the same result using plugin configuration options. Although valid ways to migrate images, these approaches have an important limitation. The files and images are not removed from the system upon rollback. In the previous blog post, we talked further about this topic. Today, we are going to perform an image migration that will clear after itself when it is rolled back. Note that in Drupal images are a special case of files. Even though the example will migrate images, the same approach can be used to import any type of file. This migration will also serve as the basis for explaining migration dependencies in the next blog post.

Tips for writing Drupal migrations and understanding their workflow

Submitted by dinarcon on Tue, 08/06/2019 - 20:00

We have presented several examples as part of this migration blog post series. They started very simple and have been increasing in complexity. Until now, we have been rather optimistic. Get the sample code, install any module dependency, enable the module that defines the migration, and execute it assuming everything works on the first try. But Drupal migrations often involve a bit of trial and error. At the very least, it is an iterative process. Today we are going to talk about what happens after import and rollback operations, how to recover from a failed migration, and some tips for writing definition files.

Using constants and pseudofields as data placeholders in the Drupal migration process pipeline

Submitted by dinarcon on Mon, 08/05/2019 - 23:00

So far we have learned how to write basic Drupal migrations and use process plugins to transform data to meet the format expected by the destination. In the previous entry we learned one of many approaches to migrating images. In today’s example, we will change it a bit to introduce two new migration concepts: constants and pseudofields. Both can be used as data placeholders in the migration timeline.

Migrating data into Drupal subfields

Submitted by dinarcon on Sun, 08/04/2019 - 19:00

In the previous entry, we learned how to use process plugins to transform data between source and destination. Some Drupal fields have multiple components. For example, formatted text fields store the text to display and the text format to apply. Image fields store a reference to the file, alternative and title text, width, and height. The migrate API refers to a field’s component as subfield. Today we will learn how to migrate into them and know which subfields are available.

Using process plugins for data transformation in Drupal migrations

Submitted by dinarcon on Sat, 08/03/2019 - 09:00

In the previous entry, we wrote our first Drupal migration. In that example, we copied verbatim values from the source to the destination. More often than not, the data needs to be transformed in some way or another to match the format expected by the destination or to meet business requirements. Today we will learn more about process plugins and how they work as part of the Drupal migration pipeline.

Writing your first Drupal migration

Submitted by dinarcon on Fri, 08/02/2019 - 09:00

In the previous entry, we learned that the Migrate API is an implementation of an ETL framework. We also talked about the steps involved in writing and running migrations. Now, let’s write our first Drupal migration. We are going to start with a very basic example: creating nodes out of hardcoded data. As we progress through the series, the migrations will become more complete and more complex. The focus of today's lesson is learning the structure of a migration definition file and how to run it.

Drupal migrations: Understanding the ETL process

Submitted by dinarcon on Thu, 08/01/2019 - 09:00

The Migrate API is a very flexible and powerful system that allows you to collect data from different locations and store them in Drupal. It is, in fact, a full-blown extract, transform, and load (ETL) framework. For instance, it could produce CSV files. Its primary use is to create Drupal content entities: nodes, users, files, comments, etc. The API is thoroughly documented and their maintainers are very active in the #migration slack channel for those needing assistance. The use cases for the Migrate API are numerous and vary greatly. Today we are starting a blog post series that will cover different migrate concepts so that you can apply them to your particular project.

What is a view in Drupal? How do they work?

Submitted by dinarcon on Mon, 07/29/2019 - 07:00

In Drupal, a view is a listing of information. It can a list of nodes, users, comments, taxonomy terms, files, etc. A view scans your website using any criteria you specify and presents the results in the format of your choice. Example formats include a HTML table, a RSS feed, a PDF document, a CSV document, an interactive map, an image slideshow, or a JSON representation to be used as a REST endpoint. The same content can be presented in multiple formats at the same time. For instance, you can present a table of user information and on the same page a link to download the data in CSV format.

Let’s continue our journey to understand more Drupal concepts. As you might have already noticed, they build on each other. Today, you will learn how nodes, content types, and fields can be used as part of views configurations. Also, you will find examples of blocks that are created using views.

Using Drupal blocks to enrich your website's content

Submitted by dinarcon on Fri, 07/26/2019 - 16:00

We have already talked about nodes, content types, and fields. In Drupal, they often comprise the main content of a page. Very likely you will want to display extra information along the page. This can be accomplished using containers called blocks. For example, the main content of a page can be a news article and a block can be used to display a list of other articles written by the same author. You could also use a block to show a search box or copyright text. Let’s explore what Drupal blocks have to offer.