Skip to main content

Drupal 7

warning: Creating default object from empty value in /var/www/ on line 33.

Restrict nodequeue by field values

File under

A couple of times now I’ve wanted to restrict what can go into a nodequeue by more than just the node type. A good example of when you might want to do this (though not my use case) is if you want to restrict the blog posts that can go into a carousel to only those posts that have an image. In any case, there are three steps to putting your restriction in place:

  1. Apply greggadson’s nodequeue patch:

Setting the Default Value for Views Exposed Filters

File under

Sometimes the help you’re looking for is in the unlikeliest of places, which, in this case, is – ironically – the likeliest of places. And yes, that is all proper punctuation and grammar.

Needing to know how to set the default value for an exposed filter in Views (there’s no way to do this via the UI that I can find), a Google search turned up the Views API docs. MIND = BLOWN.

Creating a Rules event for unblocking a user

File under

Oddly enough, the extremely useful Rules module doesn’t come with an event for unblocking a user. Thankfully, implementing a custom event for this occurrence is really easy. There’s two basic steps:

Creating Custom Formatters with Display Suite (and Why You Should Bother)

File under

I’ve been making heavy use of the [Display Suite][ds] module lately. It obliterates a lot of the more tedious theming issues I typically run into when building out a Drupal site, and for the most part, I love it. But as with any solution that takes logic out of code and puts it into the UI, if you want to do anything that isn’t already provided by DS, you’re going to have a write a bunch of code.

So far, the biggest drawback to using DS that I’ve experienced so far is the lack of formatters. For example, suppose you have something like an Action content type with the following fields:

Video Thumbnails with Media and YouTube or Vimeo in Drupal 7

File under

Today, one of the designers I work with asked me a pretty simple question about a Views-based list of videos. The listing displays thumbnails of videos being pulled from YouTube and Viemo. The question was: how do I change the size of the thumbnails?

It’s easy enough to change the size of images, but the process gets fairly confusing when it comes to other content types. Here’s a quick breakdown of the steps I took to enable video thumbnail resizing:

  1. Create an image style.
  2. Set the effect you want on the image style.
  3. Create a file style.

Restore Deleted Fields in Drupal 7

File under

In D7, if you delete a field from a content type, the field data stays in the database. And yet if you later add that same field back to that same content type, the data does not reappear. Zuh?

It’s the new deleted field in each field_data_<field_name> table that governs this behavior. So if you accidentally delete a field and want that data back, just change the deleted field from 1 to 0.

Kinda cool I guess, though it sort of reminds me of the trash can in WordPress. As far as I can tell, though, there’s no UI for adding back deleted fields.

Syndicate content