Blogs

From time to time there's a bit of a sour post in an issue queue or blog post that makes it clear that there are misunderstandings about how the Drupal community works, and in this case it was a disgruntled post regarding lack of support for a particular module. It got my blood a-boil, and this was my response after I calmed down a bit:


Mr. Anonymous,

Perhaps it's the language gap, but your posts are coming across pretty harsh. Or, maybe you're just figuring out how parts of the Drupal space actually works and you're frustrated by it. That's understandable - it's tough realizing that Drupal isn't actually run by a team of tireless developers with infinite patience and no bills to pay - and I don't mind bearing the brunt of your frustration if I can help you and other folks in your shoes come to terms with a more accurate perspective.

From a user's point of view, in the ideal world every developer would have the time and desire to regularly pummel their issue queues into submission (like some people). In the developer's world, things look a little different. Most of us have enough going on that we have to prioritize what gets done, and that depends on a huge number of factors, including but not limited to:

  • Can the module / community work be integrated into client work? (i.e. killing two birds with one stone)
  • What kind of time is there beyond client work (i.e. bill-paying work) is there to work on other projects?
  • Out of the numerous projects that you have on your plate, which ones are the most important strategically in getting you closer to your longer-term goals?
  • How many people will be affected by your work?
  • Who are the people will be affected by your work?
  • How educational or exciting is the work going to be?

I may be speaking just for myself, but I'm not positively influenced by how upset a single community user gets about poor support. That sort of reaction means that the user probably has some other pressures in their life impacting their overall happiness and they aren't going to get an awful lot happier through you responding to their demands. So posts like yours above beget the opposite reaction to what you were probably hoping for. I'm actually less enthusiastic about tackling the issues you mentioned, not out of spite, but just because I can't help but get a little bummed out.

Each module on Drupal.org has a backstory, and some of those stories involve a developer who actually is tireless and is doing this work only because of a pure desire to make Drupal better and push their own skills, and it's this focus that allows them to put a strong focus on supporting the module, regardless of who asks or what they're getting paid.

There are other situations where a developer creates a module because they are asked to do so for a client - as with this particular module. What I was actually asked for was a particular feature, and upon my suggestion the client generously agreed to sponsor the extra time that would be required to make the feature modular and share it on Drupal.org - i.e. they understood the value of sharing. I wouldn't have built this module without the financial support because I don't have enough use cases to justify the time required. So my motives are around making the client happy while sharing as much of the work as I can with others.

Now here's the next part of the equation, which is where you come in. You found a good use case for the module - which is great, but doesn't mean that it changes how or when I can work on it. Because the code is open source and free to use, however, you now have the ability to actually go in and fix those problems you've found, or find someone who has the skill set to do so. You're free! You're not beholden to my currently limited ability to offer support, you can actually take action and get something done. And I'd say that in contrast to what you suggested Drupal was all about, that this is a lot closer. It's people doing what they can, when they can, as they need to, and sharing it all.

Good luck!
Chris

Upgrading Drupal from one minor version to the next can be time-consuming and error prone. A lot of folks use Drush for this, but a good second choice for the commandlinophobic is to use a patch file. 

Bernhard Fürst creates patches from all previous minor versions of Drupal 5 and 6 to the current release and posts them here. I've used this method several times, and it's gone really smooth.

First, go to your sites /admin/reports/updates page and see what version of Drupal you're running. Here's what mine looks like:

So, I'm on 6.16 and need to upgrade to 6.17.

Next, go to the list of patch files and find the one that matches up with your version. Click on it to download:

Move the downloaded patch to your Drupal site's base directory.

Now, we need to move to the command line. Sorry, commandlinophobes.

First, cd to the directory where you just put the patch file.

Before we run the patch for real, we're going to do a quick dry run to make sure that we don't get any errors. You'll need to use the actual patch file name you downloaded:

patch -p1 --dry-run < drupal-6.16-to-6.17.patch

You'll see a list of everything that gets patched. If you see any errors having to do with HUNKs, then you should probably use another method to upgrade.

If everything looks good, then run the patch for reals:

patch -p1 < drupal-6.16-to-6.17.patch

Now, run /update.php.

Update: Check out an article Kalid posted in the comments that shows how to automate this process via the command line. It's more command line-heavy, and if you're going to get that heavy it's just a tiny step over to using Drush, but is still pretty cool.

Here's some additional information about upgrading if you run into issues:

The drupal.org handbook page on upgrading with patches
The drupal.org handbook page on upgrading in general
The list of patch files
* Also reference the UPDATE.txt file in your Drupal site's main directory for more information

OCR-ed content: 
Prupal 6.16 Update available Recommended version: 6.17 (2010-Jun-02) Download Release notes Includes: Block, Color, Comment, Database logging, Filter, Garland, Help, Menu, Node, PHP filter. Path, Search, Statistics, System, Taxonomy, Trigger, Update status. User 6.16 VERSION 17 [2010- Jun- 02) (2010-Jun-02) 16 Y.1 drupal-6.12-to-6. 17. patch drupal-6.13-to-6. 17. patch drupal-6.14-to-6. 17. patch drupal-6.15-to-6. 17. patch drupal- 12- to- drupal- 14 to- dru al-6 15-to 6.17 tch drupal- 16- to- 17 patch dru 6.17 16-to-6.17 6.12 dru S.13 DRU pa 6.13 17.ua-.ch 616 17. patch G.14 G.1Z pa G.Ij 6.16 r&lt;i

The other day I got a message today from killes that the Drupal Planet was getting a ton of 404 errors on the images in my posts because I was using relative URLs, and because I've been going a bit gangbusters on the imagery lately, the errors have been compounded. These 404 errors pollute the error logs, making is more difficult to identify important errors, and apparently I'm not the only one with this issue. You, too, could be responsible for log pollution!

Luckily, I ran into a module called Relative Path to Absolute URLs a while back when figuring out how to send launch MailChimp campaigns from Drupal (module forthcoming) that will add an input filter to convert relative URLs in your images and links to absolute ones. So, I installed it, enabled the filter, and all was well with the Planet.

If you're contributing to log file wash-out with relative paths, use Relative Path to Absolute URLs and help keep the Planet clean.

The goal of this post is twofold: To thank everyone who reached out during this campaign, and to summarize and pass on techniques I learned in the process.

A thank you from me

It was really inspiring to have so many people respond to the campaign. There was great feedback from artists, lots of tweeting and re-tweeting, blogging and even financial contributions to a bounty to the person the generated the lead that would land Joseph his dream job. So a big thank you to everyone who stepped up, you are all very awesome. There's a lot of need out there, and it's hard to not feel so overwhelmed by it that doing anything feels too small, too insignificant. Whenever I see people overcome this and do small things for others, it moves me and helps me to get over the inertia of doing something myself.

I wanted to specifically thank a number of people:

Suzy Tennison - For being so generous and enthusiastic about the project
Glen Hilton - For lending enthusiasm, tweeting to his massive following, and passing on some good Twitter tips
Chris Dunmire - For posting the best writeup we got on his blog, and mentioning the project in his Creativity Portal e-zine
Patrick Lee - For supplying a great lead, giving us the best quote of the campaign, and being an all around enthusiastic guy
Steve Goad - An awesome artist who gave some excellent advice on navigating the freelance art world, and wrote up a nice post
Scott Morton - For giving some tips on navigating the video game industry
TheFinalHikari- For contributing a nice, Save Joseph-inspired poem
Josh Brauer - For offering some really good thoughts on the campaign as a whole
Laura Boergadine Sapp - For some great artist-to-artist advice

If I'm missing anyone, please let me know and I'll add them in.

A thank you from the Joseph


Joseph wanted to post a thank you to everyone that lent their resources to the campaign. I believe he's putting it in his blog, but I wanted to re-post here for folks following via my blog:

About a week and a half ago I was talking with a friend about my current job situation, and how it was about to to effect my life dramatically, a classic struggle between passion and stability in my professional life. Chris wanted to help in any way possible, andn asked me if I would be interested in doing a "little experiment" with him, to try to create a buzz, around my artistic and creative abilities, let my current plight be known , and in doing so, see if he could generate some job opportunities for me. I agreed, and without another word Chris went to work on the project with an explosion of energy and enthusiasm, exploring every conceivable avenue to get me exposure, including reaching out to anyone who heard my story to come back with suggestions of there own. The feedback was amazing, everyone took time out of there busy lives to review my work, and point me in directions of possible job opportunities! Every ones effort was overwhelming, especially on Chris' part, who devoted many tireless hours to the project! I don't have a job in the art field as of yet, but the project has generated some exciting prospects, and it has opened many doors of opportunity. I just want to give a heart felt thank you to everyone involved, for reaching out to help.


Regards,
Joseph Cowman 

A wrapup of techniques

I spent 4-6 hours a day for a week or so working on the campaign and leveraged it as a great excuse to really assess what I know about marketing, about social networking, and use it as a catalyst for generating some new ideas and techniques. My hope was that taking the machine-gun approach would help me land on something viral that would really take off. Nothing quite did that, but the efforts generated about 600 unique visitors over the course of a week. This is by no means viral, but it's respectable. For a newer artist, getting your work in front of 600 people can take some doing using traditional means. Also, there will be a long tail of visitors from here on out from the links and coverage out there on the web that will probably double that number in the next couple of months.

For those are are contemplating embarking on a similar venture, here's a pretty much exhaustive list of everything I tried over the course of the 10-day campaign:

  • Registered a unique domain name (savejoseph.org) and pointed it to a blog page on my personal blog. The idea was that the campaign could have some branding, but some time could be saved in leveraging an existing site with a good commenting system instead of spinning up a new site. The plan was that if there was time, a single-page site would be built in its stead. I'm curious if this had any negative effect on the campaign, seeing the savejoseph.org page branded as my personal blog. I only got one bit of feedback from someone who noticed, but if people were turned off, they might not have said anything.
  • Created a countdown image that could be added to a web site in support of the campaign - I have no idea if anyone used this besides me, but it was a fun project
  • Added a ChipIn to allow people to donate small amounts to a bounty that would go out to the person who generated the lead leading to a job. Only to people donated (and I was one), but it seems like if I had tweeted more about this, I would have gotten a better idea of how many people would have used this.
  • I wrote a press release and had a virtual assistant in India put together a list of publications that might want to feature the story. One of the ones they found was Creativity Portal, the author of which did post an article which has been driving a little bit of traffic to the campaign.
  • I submitted the press release to the Idaho Statesman and the Boise Weekly, but did not receive a response.
  • I had my virtual assistant put together a list of sites where you could do a press release for free, but I didn't get that done before the campaign ended.
  • I submitted the story to Mashable, but I don't think they covered it.
  • I submitted a request to Malcom Gladwell asking for advice (hey, you have to try!). I got a funny little response that could possibly have been automated in some way (probably his virtual assistant).
  • I posted a request for advice on http://www.deviantart.com/, which didn't get many responses. I kind of got sucked into the site and commissioned a couple pieces of art based on the campaign (to seed the idea of getting other artists to donate small, derivative works in support of the campaign), and ended up having a great conversation with an artist that had some great advice and an inspiring attitude. I would have liked to have connected with more people this way.
  • I posted questions on Mahalo and Yahoo Answers requesting suggestions for the campaign. The idea here was to garner advice, but with the thought that the people who answer questions on those sites may have seen questions about people looking for artists. Also, I was thinking that the people who read the question might become curious about the campaign. I didn't get any responses, and it's hard to track if people came to the campaign from those sources, so I'm not sure what the sum result was.
  • I spent several hours doing a video interview with Joseph, with the idea that if people could get a better feel for his personality and the neat things he's done, it would make him more real. I would have made several short videos and posted them to a blog, YouTube and Blip. However, at the end of the interview my computer ran out of batteries and shut down, corrupting the video file, so it got lost forever. It was such a time-consuming process that we weren't able to find the time to do it again.

Leveraging Twitter

  • Created a dedicated twitter account and tweeted throughout the campaign - This didn't seem nearly as effective as leveraging existing accounts, but seemed like an important thing to do
  • Tweeted regularly from my account, and had these tweets sent to Facebook - Being able to tweet to Twitter and have it update my Facebook status was a nice little time saver. Actually, what I would do was create a message in Evernote, give it a twitter tag, and it would post to my blog, which would then post to Twitter and Facebook, so I was able to tweet very rapidly across multiple social networks.
  • I asked several influential friends to give me advice on the campaign, which allowed them to assess weather the campaign was newsworthy enough to cover themselves without having to say 'um, I don't write about this kind of thing'. Plus, I got a lot of great feedback from going that route.
  • On a suggestion from a friend, I started adding Plz RT at the end of a post to encourage people to spread the word, and that seemed to work well.

Summary and brief contemplation on measuring success

In order for this story to have become viral, I think we would have needed to do something a little more outrageous. I stuck to more conventional channels because I wanted to make sure we had a good framework for launching other efforts. Also, outrageous requires a lot more creative thinking and potentially time. If I had to do this again, I would start with a brainstorming session on creative, silly, wild things we could potentially do to create buzz and see what direction that took. Setting the foundation will generate a nice long-tail of visits, and help to consolidate any sort of marketing Joseph does in the future, so I think ultimately it was a good place to start.

The Save Joseph campaign was a perfect proof that in general the path is just as important as the goal. Over the course of the Campaign, I learned a ton about social networking, met a lot of great people, saw strangers stepping up to do what they could to help, extended what I knew about how artists generate jobs and interest around their work, and in the course of all this helped to generate several leads that may well prove to achieve the end goal of the campaign - to find Joseph a job in the art world.


Now, I did realize from the outset that there was no way I could know if this venture would be ultimately successful if judged by that end goal. I'm confident that there's work out there, but not certain about how much I could accomplish as an outsider. However, I did know that if judged by the measure of learning and pushing the bounds of what I know I had a lot of control over the success of the project. On those grounds, my hopes were high and I was not disappointed.

What does a monthly archive block achieve?

I'm not sure how many people actually visit archive links for blogs. It seems like there are more natural groupings of posts, either by tag or the basic pagination, so I think it's likely not a terribly useful browsing pattern. However, there's three things do like about them:

  1. It makes it easier for other people to track your posting frequency
  2. It makes it easier to track your own posting frequency
  3. It helps distributes internal link juice in a permanent way

From what I've heard - and almost all my SEO knowledge comes second-hand - one commonly overlooked method of improving the ranking of a page is using internal links well. Google sees each URL as its own entity, so in addition to garnering incoming links to boost the PageRank of a page, you can also use internal PageRank and it works the same way.

The idea is that each page has a bucket of rank to pass out. If you pass that rank around internally, you can get a nice boost in overall ranking. But, it's important that the links stay constant on a page, since Google tracks the age of links. So while taxonomy pages do a good job of passing out links, the links on their pages may change if they're sorting from newest to oldest.

Archive pages, on the other hand, will always have the same links on each page, so if this internal linking theory is valid, it's a good method to use.

 How to set up the archive blog and pages with Views - The easy way

After I put together this blog post, a reader mentioned that there is an archive view that comes bundled with Views. I gave it a test run and it had enough of the same properties of my archive view that I'm pretty sure I must have just cloned it a year or two ago. So, if you want to go the easy way, just enable that and configure it to your liking. If you're wondering how it works or want to set it up manually, read on.

How to set up the archive blog and pages with Views - The manual way

Even though Drupal doesn't come bundled with an archive view like Wordpress, it's pretty easy to set one up with Views.

First, create a new view and add a Block display. 

Set the display to show a high number of items. I want all months to display, so I have it set to 30 for now. The screenshot is from Views 3 Alpha:

Set the filters to match whatever is showing up in your blog. In my case, it's just nodes that are a blog content type.

Next, we need to add an argument for year and month. So, click on the plus sign next to the argument box and select Node: Created year + month:

Next, we just need to select Summary, sorted ascending under Action to take if argument is not present:

You could also select Summary, sorted descending if you wanted the most recent month to display at the top.

By default, the list of months will display as a list with the number of posts per month. This is how I have mine set, and with a little styling it looks like this:

There are a few other options which you can explore by clicking on the link next to Style, which will be List by default and taking a look at the options:

The Jump Menu option sounds neat, but I couldn't get it to work with Views 3 Alpha.

Setting up the archive page

First, add a Page display.

Give the page display a URL:

From what I can tell - and it's been a while since I set this up - the only difference with the Page view is that I've set a title in the argument settings. So, click the override button to make sure this change doesn't apply to the defaults, and then click the edit link for Node: Created year + month and set %1 for the title.

You can test out this page view as long as you have some blog items already. In the Live preview section, add an argument in the YYYYMM format, like so:

In the example above, you would see a list of nodes for July, 2010.

Save the view and then set the block to display using either the block admin page (/admin/build/block) or Context (definitely check out the Context module if you haven't yet for block display settings, it makes SO much more sense). 

That's it, you should be good to go!

OCR-ed content: 
Filters Node: Published Yes Node; Type Blog entry DE Block: Add arguments Groups: Node moae: Lreatea montn In the form of MM (01 12). Node: Created week In the form of WW COL -53). Node: Created year jf nt WW Node: Created year month IntheformofYYYYMM. LI In of in /ear in the form of UYYYVM. In of ■lll'll'IMflll NIC ll .he to- n o' he to- 10 01 FY ioae lo-io- Title: The title to use when this argument is present. It will override the title of the view and titles from previous arguments. You can use percent substitution here to replace with argument titles. Use for the first argument, &quot;0/o2&quot; for the second, etc. Breadcrumb: The Breadcrumb title to use when this argument is present. If no breadcrumb is set here, default Title values will be used, see &quot;Title&quot; for percent substitutions. Action to take if argument Wildcard: is not present: [ail If this value is received as an Display all values argument, the argument will be Hide iew Page not ignored; i.e. &quot;all values&quot; found (404) Digplny ampty taxt Wildcard title: Summary, sorted ascending bummary, sorted descending Summary, sorted by number of records jwpnrlinn All The title to use for the wildcard in substitutions elsewhere. [t will to use 15 substitutions. present: If this VALUES i.e, all not o o RJ argument, c.e- de lie cf ler 62 -ecd— nb tie hen sjbslr io is GU ier'1. ar .jrr ei. ■■zli- de nb is is c-rjj LOL SH li Hi Blog archive March 2009 April 2009 15) May 2009 (10) June 2009 f3) July 2009 August 2009 September 2009 October 2009 November 2009 December 2009 January 2010 March 2010(1) June 2010(1) July 2010 (46) March try TMJ ACM (4J (3J CU. UA 2010 March BCN 2010 BCN August June AUG C0a enber be. be 11 2.1 20 20 OS 20' Arguments NODE Created year MON Styt: List Sty LI Status: using default values. Title: Override resent. It will override the title of the view and titles from previous arguments. You can use percent substitution here to replace with argument titles. Use for the first argument, &quot;0/o2&quot; for the second, etc. LCD 62 TSE IL IRA ei. nttl Path d. upai iq, r.r. PAGE .in: SETTINGS el. upai leu, r.r. tl(l»i- Live preview Display: (Page preview Arguments: 201007 Separate arguments with as though they were URL path. Preview&quot;) Automatic live argum .jrren ALTOM OTIC Basic settings Machine Name: bkxk NAME Block We rttZUSttS Use pager Paaed. 30 30 tt /ferns More link: Ma Atress: Unrestricted ACCESS 77(fe 30 IM GREET

Last night I helped my sister- and brother-in-law move to the 4th story of an apartment building, about as far into the center of the building as you can get. There was a lot of ground to cover, and we figured out an extended fire brigade chain through an elevator and down the hall. Halfway through we found a cart (featured nicely in the photo below) which really sped up the process. If can finagle one next you help in-laws move, it will make your life much nicer. Thank you cart. Towards the end a group of folks going out for the evening kindly donated some time to help us move the last elevator-full. It was great. This post stands as a mark that people do nice things for other people. Thank you people.

OCR-ed content: 
ASPEN 30 k1 61901 10 lb 8.5 x 11 8.5x11 JO AS PEN 30 AS PEN ASPEN 30 XXIS

If you're interested in in running an ad in your publication, attached is the Photoshop file for the full-page ad below.

OCR-ed content: 
SAVE JOSEPH It's choice we've all had to make before. Follow your dreams, or fulfill your responsibilities. But, we think you can do both. Help this artist become an example. http://savejoseph.org AE DO nn IEF r«»pontf hlNtl**, org ■li.iL. II

This tutorial is sponsored by the Save Joseph campaign. Only 6 more days to save one man from a roomful of teeth. http://savejoseph.org.

I've recently been using the Evernote module to blog, which has made my life surprisingly more rich. After building the module, I started using it right away and found it was the missing piece in creating a workflow that would encourage quality, rapid posting - something I've always wanted to be able to do. Now that its set up, I feel like I can write with virtually no overhead, and using images - kind of tricky when using webforms and wysiwyg - is about as easy as it can get. Even adding annotations is super simple with Skitch (writeup for a workflow with Skitch is imminent).

The ease with which I can create content made me wonder if maybe I could run an entire Drupal site's content off of Evernote. So I gave it a shot when setting up http://josephcowman.com, and it worked like a charm!

What I've done is set up four separate feeds in the Evernote module, three of which correspond to different content types, and a third which imports unpublished blog nodes with instructions for using and administering the site:

The Gallery feed expects notes with a single image. This image is added to an imagefield and is displayed in a gallery fashion on pages like http://josephcowman.com/gallery and http://josephcowman.com/gallery/untitled. The author can put the image anywhere in the post and it will be stripped out using the HTML input filter.

The Blog and Pages feeds, on the other hand, pulls any number of images in and replaces them with local copies of the images, so they would end up looking something like this blog post.

The idea in setting up the site this way is to make management of the content extremely easy. Since Evernote has a desktop application, all the site admin has to do is create or edit a page in Evernote on their computer (even offline), and any changes get pulled into the site on a cron run. So, no log-ins, no working with web forms, it's just working directly with the content without having to deal with the middle man.

I'd love to see more people experimenting with this kind of integration. It makes for a pretty tight workflow. I even take this a little further with my blog (a more detailed article will be forthcoming) by automatically Tweeting and sending my post to Facebook through Evernote as well.

OCR-ed content: 
Evernote Feeds Name Account Type Description Edit Delete Gallery Joseph's account gallery Edit Delete Pages Joseph's account page Edit Delete Blog Joseph's account blog Edit Delete Docs Joseph's account blog Edit Delete Account TYPE :ini LT-T?

The title

The "Save Joseph" campaign leverages social networking to make dreams come true during the recession

The article

Joseph has a stable job and he works with good people, but as anyone who knows him will tell you, he has a higher calling. Joseph is an artist, and his paintings are stunning. He took on a part-time job as a dental technician to support his family and jump-start a career as an illustrative artist, but it has been more difficult to get work as an artist from his small town than he anticipated. After 7 years, while his skills have been growing, he still hasn't had a real break.

The company he works for is doing well, and he's been asked to make a difficult choice. Either take on a full time position - a dream to many who have lost their jobs during the recession, but which would force Joseph to put aside his real passion as an artist - or risk losing his part time job and putting serious financial strain on their family. Joseph explains:

"I'm really thankful for what I have, and sometimes it seems selfish to push for something more. But I think we've all been given certain skills, and our real job is to find out what we can do with them."

He has one week to make the choice.

Joseph's friend and brother-in-law, Chris Shattuck, felt like there must be an alternative. For years he and the rest of Joseph's friends and family have wanted to see Joseph in a position that would push his creativity to its limits. So, Chris decided to do something about it. Leveraging his skills as a web developer, he started a web site called savejoseph.org, with the idea of beginning a grassroots campaign to keep connecting people to other people through social networking until the right opportunity could be found that would allow Joseph to merge his passion as an artist with a job that could support his family.

The "Save Joseph" campaign leverages multiple layers of social media to spread the word, including Twitter, Facebook and Blogger, using a Drupal web site as the glue holding it all together. Chris has also been tapping into his real-life social network, connecting with anyone he can think of who might be able to offer advice or point him in a direction he hadn't thought of.

"This an experiment to see if the right motive and the right goal is enough to bring a lot of people together to help improve one person's life. There's still a lot of struggling out there, and if this works out I think it will give people a little more hope."

So far, the campaign involves some creative techniques for leveraging niche social networks. For example, Chris is writing web development tutorials sponsored by the campaign and broadcasting them to a wide network of fellow workers in the web industry. There are also efforts underway to document some of the interesting projects Joseph has undertaken throughout his life and broadcast these out as videos on video-based social networks such as YouTube, Blip and Vimeo. Chris explained:

"When I was 15, Joseph blew my mind by showing me a functional robotic arm he built out of wood and hypodermic needles. It sounds strange, but it was so inspiring that it has affected me in some way ever since. I want to share that experience with others because I have this feeling that when they see what Joseph is capable of, they'll be banging down his door."

The "Save Joseph" campaign will last for 1 more week, and you can learn more at http://savejoseph.org.

Additional resources

  • Feel free to reference images at http://josephcowman.com.
  • Read more about the story here: http://savejoseph.org
  • Contact me if you need more information using the contact form

This tutorial is sponsored by the Save Joseph campaign, a grassroots effort to find a good friend, stellar artist and all around amazing person a satisfying, creative job in the next 8 days. I know the Drupal community could use this kind of talent. Learn more about the effort at savejoseph.org. If you have any ideas on how I can get the word out about this, let me know!

My use case was that I wanted to be able to use social media icons for menu items so that we could re-arrage, add or remove items directly from the menu management interface:. The result is what you see below:

To use images for menu items in Drupal, the first step is to create an override theme function for theme_menu_item_link() in your theme's template.php file. The idea is to first run your image handling bit to switch out text for images, and then hand it over to the parent theme to do the rest. In my case, I'm using the Zen theme.

/**
 * Implements theme_menu_item_link()
 */
function yourtheme_menu_item_link($link) {
  // Allows for images as menu items. Just supply the path to the image as the title
  if (strpos($link['title'], '.png') !== false || strpos($link['title'], '.jpg') !== false || strpos($link['title'], '.gif') !== false) {
    $link['title'] = '<img alt="'. $link['description'] .'" title="'. $link['description'] .'" src="'. url($link['title']) .'" />';
    $link['localized_options']['html'] = TRUE;
  }
  return zen_menu_item_link($link); // Let Zen take over from here.
}

Be sure to change the yourtheme in the function to the name of your theme. Also note that this only checks for .png files. If you want to use a jpeg or a gif, you will need to modify the code slightly.

Next, clear the theme registry (CTFC).

Now, you can use image paths instead of text for the image, as seen below:

OCR-ed content: 
Edit menu item Menu settings Path: The path this menu item links to. This can be an internal Drupal path such as node/add or page. Menu link title: sites/ ll/themes/v 1/itnages/icon-socia l-Fb png The fink text corresponding to this item that should appear in the MENU ,//www TOKEN /pagei/edit/?id= 115780915101836#!. /page to. can an OBSTREPEROUSNESS sodal- Fb DO hltp://www 115780915 10 1836#7page Tfle ESME Gallery Illustration Blog About Events Contact NASA ca Slog Abe o w iLEyents (■'-It'1, OS
Syndicate content