Behat is exploding with Fatal require errors

If you're getting fatal errors due to missing, required files, there's a good chance that you're running into the issue described here: https://www.previousnext.com.au/blog/using-behat-and-drupaldriver-beware-pathauto

In short, a menu rebuild is being called from outside of the Drupal root, thereby exploding your registry. For me, this was caused by views_content_cache, which calls views_invalidate_cache() and triggers a menu rebuild after certain entity operations. Here's how I got around that.

In your featureContext.php file's __construct() function, add:

Rendering the same for twice leads to incorrect submission

If you render the same form (with the same exact form id) on the same page more than once, Drupal will incorrectly submit all matching forms on the page to the first-rendered form. To avoid this, you must create dynamic form ids. This can be achieved by using hook_forms() to map dynamic form ids to the appropriate callbacks.

Here's an example from the usasearch_field module:

Remove language from all Drupal aliases

Drupal's locale module includes a lot of great features for supporting multilingual sites. One such feature is the ability to associate a language with a path alias. This allows you to have one node with two versions (let's say an English version and a Spanish version)--each with its own alias.

But your use case may not require language-specific paths per node. Maybe you want to call a spade a spade-- you've got a Spanish node or and English node and that's it. No fancy multiple versions.

Well then you've got a bit of a problem--a few actually. This can wreak havoc with aliases, and pathauto in particular. The solution is the Local Path Ignore module. It ignores the language of a given path, and instead forces all paths to have a language of "undefined," effectively allowing path aliases to behave the way you'd expect--one path per node.

Maintaining your installed Drupal distro

Drupal.org provides a number of pre-packaged distributions (e.g., Drupal Commons, DKAN, etc.) that allow users to get a fully-featured Drupal installation up and running in no time, but maintaining an installed distribution can be tricky. You may need to juggle distribution updates with contrib module updates, core updates, and your own customizations. If you aren't careful, it can become a maintenance nightmare!

The Drupal community has a few tools for dealing with common maintenance problems, but you'll be hard pressed to find comprehensive documentation on the matter. This blog post will make an attempt to codify best practices for maintenance of an installed distribution.

Let's start by establishing some goals. In maintaining an installed distribution, I'd like to:

Introducing Views Cache Bully: You're gonna cache your views, and you're gonna like it.

views cache bully admin settingsTucked away under the Views UI's "advanced" fieldset is a too-seldom-used option: Views caching. It allows you to cache the query results and/or rendered markup for any given view. This can drastically improve your site's performance.

Unfortunately, many people don't use this option. Maybe they don't know about it, maybe they've forgotten about it, or maybe they don't like. Well, the Views Cache Bully module is here to say "Too bad. You're gonna cache your views, and you're gonna like it."

To quote Dave Stoline (dstol):

CapitalCamp Presentation: Building an API (that people will actually use)

Uploading a copy of the CapitalCamp 2013 presentation given by David Platek and me:

If you attended the presentation, please feel free to leave feedback below!

Presentation description:

Learn why and how to expose your Drupal installation’s data and functionality via an API, and entice developers to extend your application’s reach through supportive documentation, implementation examples, and even SDKs.


Installing XHProf for Drupal

There are many ways to install XHProf, but at the end of the day, you need to accomplish the same basic set of tasks:

I found all of the various methods a bit overwhelming, so I've put together this page a resource to help you 1) Know the options, and 2) Find corresponding tutorials.

Install XHProf on your system

Here are the basic methods for getting XHProf onto your system:

Building a Multistep Registration Form in Drupal 7 using Ctools

This article provides a step-by-step tutorial for creating a custom, multistep registration form via the Ctools Form Wizard in Drupal 7. If you'd prefer to solely use the core Form API, take a look at Building a Multistep Registration Form in Drupal 7, a previous blog post. In the interest of saving time, I'm going to be lifting some text directly from that post, given that there are a number of overlapping tasks.

Why use the Chaos Tools module to build a multistep form? Well, Ctools offers a number of tools that build upon the core Form API, allowing you to create a multistep form faster. This includes providing a method for caching data in between steps, adding 'next' and 'back' buttons with associated callbacks, generating a form breadcrumb, etc.

Introducing Devit

Devit Admin
You have a live website and you need to copy a fresh version of the (live) database onto your local machine for development. Next, you need to run through one or more of these rote tasks:

  • Disable Drupal core caches (page cache, block cache, CSS & JS optimization, etc.)
  • Sanitize user data
  • Update Drupal's file system paths (public, private, tmp directories)
  • Enable email rerouting
  • Update logging and error level settings
  • Re-configure a contrib module. E.g., Secure Site (enable, set permissions, guest accounts).

Does this sound familiar? If so, I have good news! I've created a module that will help you automate that process.