Yearly Archives: 2018

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 Tech Tips

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

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

Using the Messenger Service Instead of drupal_set_message in Drupal 8

As you may know, drupal_set_message()  is deprecated in Drupal 8.5.0. Here’s a quick example of using dependency injection to use the new Messenger service: mymodule.services.yml

src/MymoduleAuthentication.php

 

Tagged with: ,
Posted in Development

Automatically Put Files Into a YYYY/MM Directory Structure

 

Tagged with:
Posted in Development, Tech Tips

Using PHPStorm for Git Diff and Merge tools (Mac)

You love git-difftool, right? Of course! You also love PHP Storm, right? Of course! This easy procedure lets you use PHP Storm as your git-difftool. Open a project in PHP Storm Click Tools » Create Command-line Launcher… Edit your ~/.gitconfig

Tagged with: , ,
Posted in Development, Tech Tips

Find and Open (in vim) Multiple Files

This is a quick set of examples for finding and opening multiple files in Vim.

 

Tagged with: ,
Posted in Development, Tech Tips