Category: Drupal

Fixing duplicate field collection item references in Drupal due to Content Translation bug

I just left a comment in the Field Collection issue queue and thought it’d be good to spread it more widely; maybe people need this fix.

For anyone still getting burned by this bug (or for that matter getting burned by using Node Clone on nodes with field collections), first apply my previous patch (or bderubinat’s, but I haven’t tested that one). That will stop further damage.

To repair your previous entries and ensure that, for example, removing a field collection entry doesn’t remove it from other nodes from which you didn’t want it removed, you can implement this script I’ve detailed in a gist: https://gist.github.com/wizonesolutions/5567549

It will give new item_ids to field collection items that it detects as appearing more than once. All my testing has indicated this is safe, but if not, please leave a comment on the gist. I hope this helps someone.

Thanks to Project Ricochet for sponsoring my time on this.

Introducing Internationalization 404 for Drupal

I released a new module for Drupal a couple days ago called Internationalization 404. This module helps you automatically use Content Translation-translated localized language versions of your 404, 403, and home pages.

Normally, you have to install Internationalization Variables (i18n_variable) and separately configure the options for these pages per-language. This module saves you time and automatically sends visitors to the correct page. Should you decide to use specific language versions with i18n_variable, this module will respect that configuration and not interfere.

All you have to do is enable the module for it to start working. No configuration required. Disable it to turn off the functionality.

Install it from the project page.

Thanks to Project Ricochet for sponsoring this work.

DrupalCamp alert: DrupalCamp Gothenburg 2013!

If you haven’t been following any of the calendars listing DrupalCamps, you may have missed the arrangement that’s coming up in Gothenburg, Sweden in a couple weeks. This wouldn’t be surprising, since it’s being marketed in Swedish. People of all languages are welcome, however, so I thought I’d somewhat rehash the post I made in Norwegian.

The camp’s pitch is: “A one-day conference focused on the Drupal CMS. Come along and learn more about Drupal and the web, and have a great day in Gothenburg in late Spring.”

Sessions are here: http://summer2013.drupalcamp.se/program/sessions

As with most DrupalCamp sites, volunteer work lies behind the site you see. A lot of people contributed really great work. Fantastic designs and solid development resulted in the site you see today. I was also involved, mostly behind the scenes. I helped with server administration, Git coordination, transferring the site to another server, and mostly with coordinating the web team’s efforts. It was the first time I had spent as much time helping organize a DrupalCamp (and I’ve been to quite a few; I’ve even volunteered at a couple).

If you’re in Europe or in the area, I encourage you to check it out. You can follow them on Twitter at @DrupalGBG.

Google Translate is getting better and better 🙂

My mobile office is now in the Toolbox

If you follow me on Twitter, you probably already know all this. If not, however, allow me to explain.

When I’m away from home, whether at a cafe or a Drupal event, there are a few things I take with me to ensure a pleasant working experience. You may have encountered me with them at a Drupal event. I’ve had the setup since SANDcamp 2012 and also had it with me at DrupalCamp NJ, DrupalCamp Twin Cities, and DrupalCamp Sacramento.

These tools definitely increase my productivity (hint: one is a USB-powered monitor that you can carry around!).

So, without further delay, check out my mobile office!

I’m a mentor at the free DrupalCamp Sacramento training on June 8!

I haven’t been blogging enough recently, but I will try to keep you posted with short updates at least. It’s been a busy first quarter of the year!

But I wanted to post to announce that I’m mentoring this training, which as I write is tomorrow. It’s full, so this is sure to be an interesting experience on my part. BuildAModule.com’s site is here (affiliate link).

DrupalCamp Sacramento: link (Fill PDF Service is a Bronze Sponsor).

Hope to see you there!

WizOne Solutions Winter Update

Update: I’ve also sponsored DrupalCamp NJ (http://www.drupalcampnj.org/sponsors/fill-pdf-service) at the Silver level.

I wondered what I should call this post, and the title I picked seemed to fit. It’s been some time since I’ve written a proper blog post about my attendance to (or sponsorship of) camps. I’ve definitely tweeted about it, but the blog posts have been lagging behind. Time passes, and opportunities do too. I think I’d be beating a dead horse to try and catch up now. I’d rather just list the highlights since around July:

  1. Was an individual sponsor of DrupalCamp LA (http://2011.drupalcampla.com/sponsors/wizone-solutions) and attended. Presented on hooks with Oliver Seldman and subbed in for Christefano’s presentation (http://2011.drupalcampla.com/sessions/professional-staging-and-deployment-todays-best-and-worst-practices). Also scored a great new photo courtesy of Sawako Leslie (thanks!).
  2. Attended my first DrupalCon…in London (ahem, Croydon)! I also did an individual sponsorship for that (http://london2011.drupal.org/sponsor/wizone-solutions) and ran a couple informal discussion sessions (BOFs).
  3. Experienced Drutober with nearly back-to-back DrupalCamps.The first was the Pacific Northwest Drupal Summit. This was a pretty cool event (yeah, sponsored this also. See a trend? http://pnwdrupalsummit.org/sponsors/wizone-solutions). It was targeted more at developers, apparently, and it was really well organized. I mean really well. Everything just went so smoothly and was so professionally done. My paltry $50 (OK, $200 total) was worth every penny.

    The second camp was the Bay Area Drupal Camp, a.k.a. BADCamp. (Individual sponsorship in profile: http://2011.badcamp.net/attendees/wizonesolutions.) I had to work for this one (the Coder Lounge was around 15 minutes away from the sessions), but it was worth it, and I made some new acquaintances. My session on Fill PDF also made it in at the last second (http://2011.badcamp.net/program/sessions/fill-pdf-module-web-form-data-completed-pdf-form-out). That was surprising, but cool, and the presentation went pretty well.

    Drutober was interesting because it was the first time I went to DrupalCamps with concrete goals. I think that helped me get more out of it.

  4. SANDcamp 2012 (two sponsorships! https://www.sandcamp.org/sponsors#block-views-sponsors-block-11 and https://www.sandcamp.org/sponsors/fill-pdf-service) and DrupalCamp NJ (individual sponsor; see this page: http://www.drupalcampnj.org/event/attendees) are coming next.

So it’s been an interesting year. In the coming year, I’m hoping to polish up Fill PDF Service and make it properly rock. That’s part of the reason for trying to ramp up the marketing a bit. We’ll see how it goes!

(And I’ll try to write more.)

Drush Make: Avoid the Unexpected

There are two things that are no secret and which form the basis for this post:

  1. Using the development versions of Drupal modules is sometimes the best choice.
  2. Using development versions as the project[module_name][version] parameter in a Drush Make file is always a bad choice.

How can we reconcile these two seemingly irreconcilable truths? The answer is actually very straightforward, and it’s even documented in Drush Make’s README.txt file itself1!

I tweeted a link to this pastebin snippet the other day. Keep that open, and let’s take a closer look.

This example comes directly from a Drush Make file I actually use:

; Download the module with Git
projects[webform_userpoints][download][type] = "git"

; Find this revision by clicking View Commits on the project page
; in the lower right-hand column. Click on the most recent commit
; in the branch you were going to use. Copy and paste the full revision
; identifier.
projects[webform_userpoints][download][revision] = "25bfe11d2c6dc6480d0aabc79b1edb54dec06236"

; Tell Drush Make it's a module. This might not be necessary.
projects[webform_userpoints][type] = "module"

; You can erase or change the subdirectory. I like to separate
; my Git-downloaded modules.
projects[webform_userpoints][subdir] = "_custom"

The comments are there for explanatory purposes, of course. They explain the basics, so let’s look at the finer points. First of all, what was my thinking behind doing it this way? To answer that, take a quick look at the Webform Userpoints module and the available releases. I’ll wait.

OK, as you can see, this module only has a development release. However, I’ve also used this technique for modules where the development version had a feature (or even a bug fix) that I needed. The benefit of doing it this way instead of simply specifying the version as “1.x-dev” is that your site will never suddenly stop working after a Drush Make (or Aegir)-based deployment because of the latest development version having different code than you expect (i.e., new code). Git repository revisions are fixed points in time and code. You can rely on them not changing. This is a very good thing.

Finally, I thought I should include a screenshot of where to find the commit identifier. There are a couple places; let’s start with the one I used the first time:

Click the "View commits" link on a project to get here

That’s the View Commits page for Webform Userpoints. It’s accessible through the right sidebar. You usually want the latest one for the development version you need. Click on it, and then click here to skip ahead.

Sometimes, though, especially in actively-developed projects, you’ll find that there are so many commits that it’s impractical to find the revision that way.  In these cases, the Repository Viewer is the answer. To get there, click Repository Viewer on the Drupal.org project page of the module or theme with which you’re dealing, and then under the heads section, find the one that looks like the development version you wanted. This will typically be something like 6.x-1.x. Next to that, you’ll see a few links such as shortlog, log, and tree. Click log, and then click on the title of the latest commit.

With either approach, this type of page is your final destination:

Once you click a specific commit, you wind up on a page like this

The highlighted text is what you want. This will be different for you unless you’re doing this for the same revision of the same module.

Bonus developer method: Clone the repository with Git and check out the branch corresponding to the development version. Run git log and copy the full commit identifier. Stick it in the right place in the Drush Make file. You probably didn’t even need me to write all this if you’re using this method.

1 http://drupalcode.org/project/drush_make.git/blob/086793e8887008a7841a5ef6081f8cf2766347db:/README.txt#l268

UPDATED: Weird fix for CCK fields not appearing with Display Suite (Drupal 6)

Update: Oops, this wasn’t the problem at all. It was actually with the Content Permissions module. Forgot the site was using it! Pretty embarrassing 🙂

I just went through quite a struggle getting my CCK fields to appear on my Display Suite-managed node. I finally succeeded, though, in the end, and thought I would share the solution.

Don’t worry, there isn’t much to read: just disable and re-enable the Node Displays CCK (nd_cck) module found within in the Node Displays Contributions module.

I initially tried disabling and re-enabling all Display Suite-related modules, but that didn’t work. For some reason, however, disabling and re-enabling that specific one did.

Hope this solves someone’s problem!

(To read my full rant, check out this issue comment and the ones below.)

Multi-conference report coming

I’ve been to several camps this summer and early fall, but I haven’t really written anything about them since I mentioned sponsoring DrupalCamp LA 2011. I’ve decided that I’ll probably never document them individually but that a combined blog post would be reasonable. I’ll write this soon, probably next week (once things calm down a bit).

There will be pictures.