Don't Hack Core! - Breaking Drupal's Cardinal Rule

DON'T HACK CORE! It's THE cardinal rule of Drupal. Like another rule, Don't eat yellow snow, it's inviolate...immutable...or is it?
There is one circumstance when hacking core is a good thing. "Really?" you ask. Yes, definitely. Hacking core is a great way to find out how a particular part of Drupal is working, particularly if you can't use something like xdebug. In that case, if you want to see what the world looks like when you get to a certain place in the code, there's nothing better than sticking in some debug code. There are, however, some precautions you should take:

D8 - What to Do If You Have Macports and No Composer

I was listening to Webchick's presentation on Upgrading YOUR Module to Drupal 8 (https://www.youtube.com/watch?v=wKdU2Q1NIZQ), following along with my own contributed module (https://drupal.org/project/node_theme) and when she reached a seemingly innocuous step

  • Installation:
    • drush dl drupalmoduleupgrader
    • cd drupalmoduleupgrader
    • composer install

I received the following response in my Mac terminal window

Making the ssl Connection in Drupal

There are times when the connection to your Drupal DB will need to be via ssl, such as when using an external DB service like clearDB. How do you accomplish this with regards to the settings.php file?


Add the following to your database array:

      'pdo' => array (

            PDO::MYSQL_ATTR_SSL_CERT => 'path-to-cert.pem',

            PDO::MYSQL_ATTR_SSL_KEY => 'path-to-key.pem',

            PDO::MYSQL_ATTR_SSL_CA => 'path-to-ca.pem',

To Be, or Not To Be: the Empty Entity Reference

To be, or not to be, that is the question. Shakespeare never quite gets around to answering it, though. In Drupal 7, a similar existential question arises regarding entity references: Is it, or is it empty? Unlike Will, we can answer this question.

With other field types, we can check to see if the field is empty by doing something like this:

if (sizeof($form_state['values']['field_x'][LANGUAGE_NONE]) > 0)

Omitting Drupal's admin overlay from selectors

I had an issue recently, where I was using a selector to add menu tabs to the edge of the content area. Getting them to appear wasn't the issue. Getting them NOT to appear on admin overlays was.
The body class on which my selector was based didn't change when an admin overlay covered the page. It was still .front. So, how to do the equivalent of the following pseudo-code?
if body class = front but not an admin overlay?
What DOES change in the markup is the html tag. It has the class

Don't Stress Over Local Passwords

Are you working in a multi-server environment, such as local, staging and production? If you don't have User 1 (or some other user) access in your local setup, it's easy to remedy.

Enter drush and its user-password (upwd) command. Changing a password is a cinch, whether you know the existing one or not, if you have drush access to the site, which you hopefully do, on your local development server.

drush upwd <username> --password="<new password>"


drush upwd admin --password="let-me-in"

Giving Nodes a Wardrobe - meet page_is_node() and drupal_is_front_page()

If you've been using Drupal for awhile, you probably understand template hinting and how you can format one content type differently than another, by having a template file such as


Recently, however, I had the need to format a single content type differently depending on where it was presented:

Subscribe to Drupal