Rerunning update hooks in D8

Note: there be dragons here... read all the way through before trying this.

When I'm writing an update_hook for a module I'm working on I often need to run it multiple times in order to get it working just right. In Drupal 7 I had a little trick where I would run my updates and then reset the schema version of my module  directly in the database and then run my updates again. I'd rinse and repeat until everything worked as desired.

Read on

Smarter Image Cropping - Focal Point

Automatically scaling and cropping images can save you tons of time when you are uploading images to your site. The problem is that, by default, Drupal gives you very limited control over what to crop:

Read on

C'mon Drupal: Make Displaying Images Easier with Representative Image

Sometimes Drupal makes me bang my head on the desk. It can perform all these incredibly complex tasks and support countless technologies but occasionally it's the simple problem that flumuxes it. For a long time I've been banging my head against just such a problem: lets say I want to create a list of content containing different types of content each with an image.

Read on

Do Websites Go On Vacation?

It's well known that websites have traffic patterns and that there are those times of the day/week/month/year were traffic predictably increases or decreases. Just like the 405 in LA, or the LIE in New York, or the 75/85 connector in Atlanta, traffic is likely to be pretty light at 2:00am on a Sunday, but travel those same roads 30 hours later and, well, bring a book...

Read on

Hacking Core & Contrib Responsibly

By now we have all (hopefully) heard the Drupal mantra "Don't hack core!" Usually this statement is followed by a quip about killing kittens and then a long (and necessary) diatribe about how hacking core makes it more difficult to maintain your site; leads to unexpected behaviors; and makes debugging issues adventurous. These things are all true. Very, very true.

Read on

Maintaining different settings on different environments with Drush

On nearly every site I have ever worked on there has been one or two settings that I wanted set differently on dev as compared to prod. Of course I could just set the settings locally, however every time I would bring the production database down those settings would be overridden. For example I always want to have the devel module enabled locallay to —ya know— help me devel, but I amost never want it enabled on production. To solve this problem I've written a simple Drush command called "environmnet." Here's how it works…

Read on

Applying a Patch from in 2 Seconds or Less

I used to apply patches from by goeing to the issue page where the patch has been posted, downloading the patch to my desktop (or wherever) and then applying it using git apply /path/to/file.patch. Today I figured out a better way.

Open your favorite terminal application <cough>iterm2</cough> and cd to the git repository to which you want to apply the patch. Then type

Read on