Blog Archives

Modifying Rows During a Drupal 8 CSV Migration

Migrate Source CSV is currently the source plugin of choice for doing a CSV-to-Drupal migration with the Migrate API in Drupal 8. In this post I will demonstrate how to manipulate the CSV data in realtime during the migrate:import operation.

Tagged with: , , , ,
Posted in Development

404 Error Serving a /libraries page in Drupal 8

It took some time to figure out why I kept seeing a 404 error (page not found) on http://www.mysite.com/libraries. The issue seemed to only present itself on our Acquia environments. Ultimately I realized that there was a conflict due to

Tagged with: , ,
Posted in Development

Joining Strings in a Drupal Views Field using Twig

I have two optional fields on a Drupal 8 content type: City and State. Both are rendered as simple text. In a fields-based View I wanted to show the field output as “Portland” or “Portland, OR”, or “OR”. First, I added the two

Tagged with: , , ,
Posted in Development

Drupal + Twig: Render Taxonomy Terms and Comma-Separated List

Here’s a snippet that renders the terms in a multi-value taxonomy reference field (in a node template) as plain text items separated by commas. Yes, you could get the string into the desired format using PHP, but I wanted to

Tagged with: , ,
Posted in Development

Migrating Specific Fields in a D8 Migration

I recently needed a way to update the value of a single field of a D7 to D8 node migration. The client was already updating the migrated content so I had to be careful with what I migrated. The entity

Tagged with: , ,
Posted in Development

Migrating a Drupal 7 User Profile2 Image Field to a Drupal 8 User Image Field

Consider this scenario: Drupal 7 site contains Profile2 profile called person with image field called field_oldsite_person_image. Users each have a profile2 profile associated with their account. Drupal 8 site has an image field called field_newsite_user_photo on the user entity itself. If you need to

Tagged with: , , , ,
Posted in Development

Quick Tips for a Drupal 7 to Drupal 8 Migration

Here are a few quick tips for a Drupal 7 to Drupal 8 migration. I will add more over time; admittedly it’s pretty lame right now! For general Drupal 8 Migrate API tips, you may also want to check out

Tagged with: , , ,
Posted in Development

Only Migrating Published Nodes in a D7 to D8 Migration

I’m not going into much detail here but hopefully this helps someone. If you need to migrate only published nodes you can extend the d7_node plugin and add a condition to the query. First, create a file in your module like /modules/custom/mysite_migrate/src/Plugin/migrate/source/MysiteNewsNode.php

Tagged with: , , ,
Posted in Development

Using GROUP_CONCAT to Combine Rows in a Drupal Query

Recently I was working on a D7 to D8 migration. I was trying to import news items and their taxonomy terms (among many other things). To make things simple I wanted the query results to have (for each node) a

Tagged with: , , , , , , ,
Posted in Development

User-chosen Field Output Styles in 5 minutes using Display Suite

I’m working on a site that has a “Statistics” paragraph bundle. The output looks like this: The specification calls for the content author to be able to choose between a few different visual styles for the header (title), shown as Statistics:

Tagged with:
Posted in Development