Tag: 7

Cloning Content Types in D7 – Errata

Update: You may also want to check out the Bundle Copy module. I haven’t tried it yet, so let me know in the comments if it works!

Recently, I read the Stanford Tech Commons article on Cloning a Content Type in D7 at https://techcommons.stanford.edu/topics/drupal-7x/cloning-content-type-d7. It proposes a simple but (mostly) effective way  to wind up with cloned content types in Drupal 7. Summarized:

How-to: Create Drupal development sites in Quickstart

Yesterday, I felt like reviewing some patches, so I fired up my Quickstart-based virtual machine and set about creating some Drupal development sites. I realized I first had to create Drush Make files to get the proper development versions installed. So I did that. However, I also realized that, despite cloning the code via Git and checking out a particular branch, the Git clone was not actually a Git repository. This is because Drush Make requires the –working-copy switch in order to do this. I’ve posted a workaround on the Quickstart issue queues. This post mostly serves as pointers to a couple things:

Challenge Accepted (or: Migrating Site to Drupal 7)

If you’ve viewed source on my site or followed me on Twitter, you’ve noticed something strange: I’m a Drupal Developer, but my site runs WordPress. What the heck!?

A certain tweeter also implied that this site would be too hard to do in Drupal.

Well, paying respect to the old Wild West…them’s fightin’ words!

First, the backstory: This site was set up before I specialized in Drupal. Once I specialized in Drupal, I got too busy to convert it! Until now.

I don’t want any more tweets like that, so I’m aiming to convert it before or during DrupalCon London.

Stay tuned for updates!

Code Snippet – Open Link in New Window in Drupal 7

Although this is not recommended, I’ve seen the question mentioned in the topic come up a couple times over the last few weeks:

How do I get my links to open in a new window or tab in the user’s browser in Drupal 7?

I’ve heard that the target=”_blank” method is once again valid in HTML 5…however, it will still make your HTML fail validation under other specifications. The way around this is to use JavaScript.

Copy and paste this snippet into the appropriate area of your site – usually a JavaScript file in your theme. When you want to make a link open in a new window or tab, instead of target=_blank, add rel=”external”.

(function ($) {
Drupal.behaviors.externalLink = {
attach: function (context, settings) {
$('a[rel="external"]', context).attr("target", "_blank");

The reason this workaround is OK to use is that it does a little something called separating presentation from behavior. In other words, you aren’t relying on the browser to take a particular action because of the HTML itself; you’re telling it what action to take in the JavaScript.

Presentation on hooks goes primetime!

Just chiming in to express excitement about my presentation on hooks in Drupal (Why Drupal uses hooks, and why you should too) got scheduled for the largest room in the venue! Looks like I’d better be doubly prepared.

Thanks again goes to Oliver Seldman for inviting me to co-present this with him originally and for all the help with the slides and content, especially the simplicity of the presentation. Please give him your money.