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

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

Adding Fields to Inline Entity Form Table

Inline Entity Form is a useful module for reference entities and being able to edit them in place. Here’s what the edit form looks like out of the box for an unlimited value entity reference: Often it’s helpful to provide additional information to your

Tagged with: , ,
Posted in Development

Basic HTTP Authentication in Drupal Site Using settings.php

Here’s a quick and painless way of preventing public access to a Drupal site using settings.php (or settings.local.php). I’ve been using this for development and staging sites that I want to keep private. If you want this to be available

Tagged with: , , ,
Posted in Development

Valet+ Quickstart for Drupal Development

Here’s a README.md file that I’ve developed over time. It explains how I setup and use Valet+ for quick and powerful Drupal development. Sorry for the formatting. I’ll get markdown support on my blog sometime…

 

Tagged with: , , ,
Posted in Development

Drupal 8 User Photo Update Form

Recently I had to come up with a simple way for users to change their member profile photo without requiring them to visit the user edit screen. Here’s the result: First, I added a new Image field called “Member Photo” to

Tagged with: ,
Posted in Development

Creating a Drupal 8 Route to a User Page with Dynamic User Object

It took me some time to figure out the right combination of properties to make this work. My goal was to create a form that lives at /user/UID/photo (think /user/1/edit). I wanted the user object to be passed into the

Tagged with: ,
Posted in Development

Make a Field Label “visually-hidden” in Drupal 8

Using the Form API you can add a visually-hidden class to a field using the “#title_display” property as shown here:

 

Tagged with: ,
Posted in Development