Drupal, Lando, S3FS module, and Image Styles

The bug: Image styles don’t generate (they all return 404) when using the following:

So you’ll need to override lando’s default vhosts file. You can do so by doing the following in your .lando.yml file.

Then you’ll need to create a file in your app root lando/default.conf . To start, you can go to the lando/drupal recipe page , go into the recipe you’re using, and then copy the default.conf.tpl into your lando/default.conf file.

Next, locate the following snippet:

And replace it with the following snippet (only regex is changed)

I also opened a GitHub issue in case someone on the project wanted to commit back to the project. I may get around to it if I have time.

Hope this helps. I spent a couple hours on this since I didn’t know why my image styles weren’t generating and I couldn’t find anyone else that was running into the same problem. Good luck!

WordPress, New Server, and “Unable to create directory”

I recently had to move my blog from WebFaction (who was bought out by GoDaddy and then eventually shut down their services) to Digital Ocean.

I couldn’t upload files for the longest time and kept messing with file permissions as recommended from all the different Google searches I did. And nothing was working.

Turns out, my server was configured properly, but I forgot to change the Store uploads in this folder value via WordPress dashboard when I switched webservers at /wp-admin/options-media.php.

Change this value to the server’s new value!!

Hopefully this helps someone else.

Drupal 8, Smartling TMGMT, and Local Development

If you use Smartling for translation management and it’s all setup for production, here’s how to override those values on your local development environment to download pseudo-translations for easier debugging if you don’t need to test actual translations.

Add this to your settings.local.php:

Migrating Drupal 7 Image Files to Drupal 8 Media Images (no PHP required!)

I’m new to migrate. And it’s a beast. But I think after a few dozen hours of diligence, I think I’ve figured out my preferred method.

This post is for someone who already understands how to use views, develop custom modules, and knows how to use drush migration operations.

I originally tried using migrate_drupal, which honestly did a great job at migrating my user roles, users, and taxonomies. But the site I am migrating is 5 years old with a good amount of technical debt having been touched by over 10 (and maybe even 20) developers over its lifetime, so I think it’s time for a fresh start. I want to migrate everything else (content types, files, etc) manually.

All the Drupal 7 content types were using image (file) fields, but I want the new Drupal 8 site to use media fields. I couldn’t use the migration provided by migrate_drupal, so I had to get creative.

This will be a two step process:

  1. Use D7 views_datasource module to create JSON endpoints on my old site (and since we’re using a JSON source, you can honestly migrate from anything).
  2. Write a custom migration in D8.
Read more

CSS Bold Hover/Active States – An Alternative

Lots of other places suggestion using text-shadow to handle bold hover/active states. My client had a complaint that it made the text look blurry (which it absolutely does). Here’s my solution (written using general CSS selectors). Let me know what you think!

The letter-spacing is not perfect, and there is still a tiny sub-pixel of movement, but it was a compromise between actually-bold text and blurry-bold text. Adjust to your needs.

Drupal 7 – Customizing Main Menu Links

I spent a number of hours yesterday trying to figure out how to customize individual links for the main menu. Drupal 8 is a bit more straightforward, but it isn’t quite so obvious in Drupal 7. There are no template suggestions or theme hooks in the HTML comments when you turn theme debugging on, so it took me a while to figure it out.

Thankfully, with the help of PhpStorm and xdebug, I was able to pinpoint what template file to create: menu-link--main-menu.tpl.php

Here’s my code that allows me to replicate the menu links exactly. Then customize as you wish.

Drupal, PhpStorm, and PHPCS quick-start


  • Composer
  • PhpStorm

Let’s go!

1. Composer + Settings

Run the following in your terminal:

  • composer global require squizlabs/php_codesniffer:2.9.1
  • composer global require drupal/coder
  • phpcs –config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer

2. Configure PhpStorm

Open PhpStorm preferences (⌘,) and go to the Code Sniffer settings. Click the “…” button.Enter the path to your “phpcs” file and click “Validate”. It should be ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs (replace “~” with your actual home directory) Go back to the PhpStorm preferences, navigate to “Editor » Inspections”, enable “PHP Code Sniffer validation”, then choose “Drupal” in the “Coding standard” dropdown. Enjoy!

Drupal 8 RestWS for Dummies (Quickstart Guide)

Documentation for Drupal 8 is still really lacking. There is SOME documentation out there, but in typical Drupal 8 fashion, you have to sift through all of the pages and all of the content to find exactly what is relevant to you. This guide is an attempt to get you quickly started.

This guide is for dummies, but it also assumes you know the basics of Drupal 8. Specifically, you should be comfortable getting an installation of Drupal 8 up on your own, you have you’re comfortable editing text (config) files, and you have basic site-building skills (Creating content types, creating views, etc).

Before we get started, I want to say that, when I am making an API for a new app, I want to make it FAST. I am comfortable working with the MEAN stack (using MongoDB + Express to run your API server), but I consider myself fairly proficient in Drupal, so why reinvent the wheel every time manually writing an API when Drupal already does a great job at assembling and delivering data? I’m able to get my API working with GET requests in less than 5 minutes, and POST requests in less than 15 minutes.

OK, enough small talk – lets get started.

Read more

Officially Acquia Certified!

Thanks to iFactory for putting me through Acquia certification! I definitely would not have passed without having learned so much from working there in the past 5 months.

Here’s the breakdown:

  • Section 1 – Fundamental Web Development Concepts: 62%
  • Section 2 – Site Building: 93%
  • Section 3 – Front end development (Theming) : 50%
  • Section 4 – Back end development (Coding) : 77%

Interesting outcome since I feel that I’ve been really comfortable with my frontend development. Ah well. Feels good to finally be done with the exam!