By Matt Butcher
September 2009
Theming filter info
Submitted by matt on Wed, 2009-09-30 16:34In Drupal, any text area that supports markup will also display help text (filter tips) for the "input format" section beneath the text area. Unfortunately, filter tips (and particularly the filter tips "more info" link) are not wrapped in markup that makes them easily selectable from CSS. This can be easily rectified using a theme function.
Here's an example from the template.php file inside of a theme named sitetheme.
<?php /* <em> * Implements theme_filter_tips_more_info(). */ function sitetheme_filter_tips_more_info() { return '<div class="filter-tips-more-info">' . theme_filter_tips_more_info() . '</div>';; } /</em> * * Implements theme_filter_tips(). */ function sitetheme_filter_tips($tips, $long = FALSE, $extra = '') { module_load_include('inc', 'filter', 'filter.pages'); return '<div class="filter-tips">' . theme_filter_tips($tips, $long, $extra) . '</div>'; } ?>
The code above simply overrides the theming functions from the filter module, wrapping the content inside of divs. This example still uses the original theming functions (theme_filter_tips() and theme_filter_tips_more_info()), but around this content, some extra divs with easily targeted classes are wrapped. We have to call these theming functions directly (instead of using the theme() function) because we have already declared an override to the theme function, and unlike OO inheritance, there is no clean method of calling a "parent" or "super" version of a function.
Of course, in your own themes, you may find it more useful to simply re-theme the tips and more info link instead of merely wrapping existing markup with extra divs. That can easily be accomplished with the theming functions shown above.
A Simple Pattern for Importing Images
Submitted by matt on Fri, 2009-09-25 20:43When migrating legacy sites into Drupal, one challenging issue is importing images. The CCK imagefield module is one of the most popular ways to store images in Drupal 6, and we at Palantir.net use it on all of our production sites. This short tutorial shows you how to write a quick importer that can copy existing images into Drupal's files directory and then attach the image to a node using the CCK filefield. You might use this strategy within a larger importer (perhaps driven by Drupal's Batch API).
Here's a quick pattern that I've now successfully used to transform an existing image into a Drupal-controlled image stored in a CCK field.
QueryPath at DrupalCamp Atlanta?
Submitted by matt on Thu, 2009-09-24 08:58I was happy to see that QueryPath made the hallway track at DrupalCamp Atlanta. I assume I have Ken to thank for that. Ken co-presented with me twice at DrupalCon Paris -- once on how we did Foreign Affairs, and once on QueryPath (video of session).
Josh Brauer's Blog
QueryPath, Mashups, and Web Services (Video)
Submitted by matt on Wed, 2009-09-23 11:21At DrupalCon Paris, I gave a presentation on QueryPath, Mash-ups and Web Services, in which I covered the basics of using QueryPath.
I had two guest speakers with me.
Ken Rickard discussed using QueryPath to import legacy HTML content into Drupal.
David Hwang discussed how QueryPath was used to create a presentation layer on top of the Field Museum's collections management tool.
How to Make a Module (Video)
Submitted by matt on Wed, 2009-09-23 11:15At DrupalCon Paris, 2009, I gave an introductory talk on how to write Drupal modules. The talk was a hands-on walk through the development of a simple module. I wrote the module as I talked, and encouraged the audience to follow along on their laptops.
Here is the video of that presentation.
Personas|Metropath(ologies)
Submitted by matt on Tue, 2009-09-15 22:33Here's a fun, high-tech art installation from MIT that analyzes online references to your name or handle and builds a visual representation of how you appear online. I ran it twice: Once for Matt Butcher and once for TechnoSophos.
TechnoSophos' Persona
Matt Butcher is a fairly common name, and as the exhibit builds the graph, it displays the text of each source. I learned a lot about hockey in those few minutes.
Thanks to sirkitree for bringing my attention to this fun app.









Recent comments
4 hours 19 min ago
1 day 7 hours ago
2 days 17 hours ago
2 days 18 hours ago
2 days 19 hours ago
3 days 6 hours ago
3 days 7 hours ago
1 week 5 days ago
1 week 6 days ago
2 weeks 15 hours ago