0% found this document useful (0 votes)
475 views167 pages

Linux Journal - Drupal Special Edition 2012

Linux Journal - Drupal Special Edition 2012

Uploaded by

TrurlScribd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
475 views167 pages

Linux Journal - Drupal Special Edition 2012

Linux Journal - Drupal Special Edition 2012

Uploaded by

TrurlScribd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 167

DRUPAL SPECIAL EDITION

SPONSORED BY

Since 1994: The Original Magazine of the Linux Community SPECIAL SUPPLEMENT | WWW.LINUXJOURNAL.COM

DRUPAL
PROVIDES
SOLUTIONS
TO REAL
BUSINESS
PROBLEMS
WHY DRUPAL
IS NOT A CMS
BUILD AND
DESIGN CUSTOM
CONTENT TYPES TREKK:
+
A Drupal
CREATE YOUR Solution for
OWN CUSTOMIZED Universities
DISTRIBUTION
CASE
OPEN ATRIUM: STUDY:
A FREE AND USENIX.orgs
FLEXIBLE PROJECT Migration to Drupal
MANAGEMENT TOOL And Much, Much More!
LJDrupalSupplement.indd 1 9/15/12 9:57 AM
CONTENTS SPECIAL
DRUPAL ISSUE
FROM THE EDITOR 52 Achieving Continuous
Integration with Drupal
6 DrupalIts Like Ice Cream, Everyone using Drupal needs to host
Only Better their site somewhere. However, most
Katherine Druckman people building sites with Drupal do not
also want to have to become experts
OPINION in building a reliable, scalable
infrastructure for hosting it.
8 Dont Pitch DrupalSell Solutions Barry Jaspan
to Real Business Problems
Consider one of the many flavors 64 RedHen CRMan Open-Source
of Drupal CRM Solution Built Entirely
Jeffrey A. McGuire with Drupal
Implement a native Drupal
FEATURES CRM solution.
Sean Larkin and Lev Tsypin
24 Drupal Is a Framework: Why
Everyone Needs to Understand This
Demystifying the Drupal hook system. DRUPAL MARKETPLACE GUIDE
Diana Montalion Dupuis 80 Gold, Silver and Bronze Sponsors
34 Drupal Distributions: Working
the Linux Model Up the Stack INDEPTH
Prepackaged distributions are 82 Speed Up Your Drupal
being heralded as a new era in Drupal Development Using
development. Learn how to make Installations and Distributions
your own one-click downloadable and How to create your own distribution
shareable Drupal distribution. of Drupal.
Forest Mars Oliver Davies

44 Making Open Atrium Yours 99 Trekka Drupal Distribution


Even with hundreds of thousands of for Universities
Open Atrium installs, its most powerful Learn how Trekk addresses content
feature is often never taken advantage sharing challenges.
ofits an open-source project. Tim Loudon
Patrick Settle

2 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 2 9/15/12 9:57 AM


At Your Service
110 Creating and Theming a Custom
Content Type with Drupal 7 SUBSCRIPTIONS: Linux Journal is available
in a variety of digital formats, including PDF,

Building and designing custom content types is .epub, .mobi and an on-line digital edition,
as well as apps for iOS and Android devices.
easier now that a full Content Construction Kit is Renewing your subscription, changing your
e-mail address for issue delivery, paying your
built in to Drupal 7 core. invoice, viewing your account details or other
Dan Englander subscription inquiries can be done instantly
on-line: http://www.linuxjournal.com/subs.
E-mail us at subs@linuxjournal.com or reach
124 Tips for Writing Interoperable us via postal mail at Linux Journal, PO Box
980985, Houston, TX 77098 USA. Please
Drupal Distributions remember to include your complete name
and address when contacting us.
Expert tips on how to build Drupal distributions
and features that integrate cleanly on any site. ACCESSING THE DIGITAL ARCHIVE:
Your monthly download notifications
Nedjo Rogers will have links to the various formats
and to the digital archive. To access the

136 Cache in Drupal 7


digital archive at any time, log in at
http://www.linuxjournal.com/digital.

Techniques for boosting your Drupal LETTERS TO THE EDITOR: We welcome your
sites performance. letters and encourage you to submit them
at http://www.linuxjournal.com/contact or
Janez Urevc mail them to Linux Journal, PO Box 980985,
Houston, TX 77098 USA. Letters may be

150 USENIX.org: a Case Study of


edited for space and clarity.

a Migration to Drupal WRITING FOR US: We always are looking


for contributed articles, tutorials and
USENIX.org was migrated from static HTML into real-world stories for the magazine.
An authors guide, a list of topics and
a Drupal-based CMS, making use of many of due dates can be found on-line:
http://www.linuxjournal.com/author.
Drupals greatest strengths: e-commerce,
integrations with other services, Apache Solr search FREE e-NEWSLETTERS: Linux Journal
editors publish newsletters on both
integration and microsites. a weekly and monthly basis. Receive
late-breaking news, technical tips and
Jody Hamilton tricks, an inside look at upcoming issues
and links to in-depth stories featured on
http://www.linuxjournal.com. Subscribe

COMMUNITY for free today: http://www.linuxjournal.com/


enewsletters.

160 Contributing to Drupal: Open for All! ADVERTISING: Linux Journal is a great
resource for readers and advertisers alike.
Contributing to Drupal is easy and rewarding. Request a media kit, view our current
editorial calendar and advertising due dates,
Kojo Idrissa
or learn more about other advertising
and marketing opportunities by visiting
us on-line: http://ww.linuxjournal.com/
advertising. Contact us directly for further
information: ads@linuxjournal.com or
LINUX JOURNAL (ISSN 1075-3583) is published monthly by Belltown Media, Inc., 2121 Sage Road, Ste. 310, +1 713-344-1956 ext. 2.
Houston, TX 77056 USA. Subscription rate is $29.50/year. Subscriptions start with the next issue.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 3

LJDrupalSupplement.indd 3 9/15/12 9:57 AM


Guest Editor Katherine Druckman
katherine@linuxjournal.com
Executive Editor Jill Franklin
jill@linuxjournal.com
Senior Editor Doc Searls
doc@linuxjournal.com
Associate Editor Shawn Powers
shawn@linuxjournal.com
Art Director Garrick Antikajian
garrick@linuxjournal.com
Products Editor James Gray
newproducts@linuxjournal.com
Editor Emeritus Don Marti
dmarti@linuxjournal.com
Technical Editor Michael Baxter
mab@cruzio.com
Senior Columnist Reuven Lerner
reuven@lerner.co.il
Security Editor Mick Bauer
mick@visi.com
Hack Editor Kyle Rankin
lj@greenfly.net
Virtual Editor Bill Childers
bill.childers@linuxjournal.com

Contributing Editors
Ibrahim Haddad Robert Love Zack Brown Dave Phillips Marco Fioretti Ludovic Marcotte
Paul Barry Paul McKenney Dave Taylor Dirk Elmendorf Justin Ryan

Publisher Carlie Fairchild


publisher@linuxjournal.com

Advertising Sales Manager Rebecca Cassity


rebecca@linuxjournal.com

Associate Publisher Mark Irgang


mark@linuxjournal.com

Webmistress Katherine Druckman


webmistress@linuxjournal.com

Accountant Candy Beauchamp


acct@linuxjournal.com

Linux Journal is published by, and is a registered trade name of,


Belltown Media, Inc.
PO Box 980985, Houston, TX 77098 USA

Editorial Advisory Panel


Brad Abram Baillio Nick Baronian Hari Boukis Steve Case
Kalyana Krishna Chadalavada Brian Conner Caleb S. Cullen Keir Davis
Michael Eager Nick Faltys Dennis Franklin Frey Alicia Gibb
Victor Gregorio Philip Jacob Jay Kruizenga David A. Lane
Steve Marquez Dave McAllister Carson McDonald Craig Oda
Jeffrey D. Parent Charnell Pugsley Thomas Quinlan Mike Roberts
Kristin Shoemaker Chris D. Stark Patrick Swartz James Walker

Advertising
E-MAIL: ads@linuxjournal.com
URL: www.linuxjournal.com/advertising
PHONE: +1 713-344-1956 ext. 2

Subscriptions
E-MAIL: subs@linuxjournal.com
URL: www.linuxjournal.com/subscribe
MAIL: PO Box 980985, Houston, TX 77098 USA

LINUX is a registered trademark of Linus Torvalds.

LJDrupalSupplement.indd 4 9/15/12 9:57 AM


Instant Access to Premium
Online Drupal Training
Instant access to hundreds of hours of Drupal
training with new videos added every week!

Learn from industry experts with real world


experience building high profile sites

Learn on the go wherever you are with apps


for iOS, Android & Roku

We also offer group accounts. Give your


whole team access at a discounted rate!

Learn about our latest video releases and


offers first by following us on Facebook and
Twitter (@drupalizeme)!

Go to http://drupalize.me and
get Drupalized today!

LJDrupalSupplement.indd 5 9/15/12 9:57 AM


FROM THE EDITOR

DrupalIts KATHERINE
DRUCKMAN

Like Ice Cream,


Only Better
A
s Linux Journals resident Drupal put Drupal to work for your specific use case.
nerd, I could not be more pleased to Jeffrey McGuire starts off the issue with
bring you this special Drupal issue. some opinions on selling the solutions Drupal
Drupal really is everywhere these days, and its can provide rather than selling Drupal itself. In
available in more flavors than most people the process, he describes some of the products
in the Open Source community are aware that illustrate Drupals potential. Diana Dupuis
of. So in the interest of spreading awareness continues by showing how Drupal is much
about my favorite and ever-growing open- more than just a CMS, and she explains the
source project, we hope youll find this special hook system that makes the magic happen.
issue both informative and inspiring. Forest Mars walks through the evolution
I see a lot of parallels between Drupal and of Drupal distributions, highlighting the
Linux, and not just because distributions struggles and breakthroughs that have led
are such a significant part of Drupals us to the current set of development tools
current landscape. Like Linux and the Linux that make packaging specific configurations
community, I see both the Drupal software possible and portable. He then describes the
and the Drupal community embracing the fact process of making a distribution, so you can
that no one solution is right for everyones all dive in and get your hands dirty.
problem. By maintaining the flexibility of One of the most popular Drupal distributions
the platform, scratching ones own itch can is the friendly and useful Open Atrium
have tremendous benefits for all. To illustrate (http://www.openatrium.com), which is a
this, weve put together an issue full of project management software that, according
information about some products that have to the Open Atrium Web site, provides an
come to fruition as a direct result of Drupals intranet in a box with: a blog, a wiki, a calendar,
flexibility, as well as information on how you a to-do list, a shoutbox and a dashboard to
can take advantage of the same flexibility to manage it all. Patrick Settles tutorial shows off

6 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 6 9/15/12 9:57 AM


FROM THE EDITOR

Open Atriums best featurethe customization custom content laid out just right using some
made possible by using open-source software. handy contributed modules and a little CSS.
Readers who have struggled with their For more-advanced developers, Nedjo Rogers
testing and deployment workflow will find has some tips on making Drupal distributions
some comfort in learning from the struggles interoperable, which will ensure long-term
of others. Barry Jaspan will help you follow flexibility and ease of expansion. Janez Urevc
continuous integration best practices with demystifies the Drupal cache system and shows
Drupal development, a potentially resource- and how to speed up performance, which is a
time-intensive task that can be made easier. universal struggle. Jody Hamilton, one of the
Continuing with the theme of showing off participating developers, gives an in-depth
the many flavors of Drupal, both new and look at the development behind the popular
old, be sure to take a look at RedHen CRM, a Open Source community site USENIX.org. And
relative newcomer. Offering a Drupal-native finally, Kojo Idrissa is your guide to the most
CRM solution, RedHen is worth checking out important and most frequently overlooked
if you are looking for a highly flexible and part of being a successful Drupaler,
customizable CRM experience, and Sean Larkin contributing to the Drupal community.
and Lev Tsypin are on hand to give you a tour. I hope after reading this special issue, youll
Busy developers will appreciate Oliver be as enthusiastic about working with Drupal
Davies tips on speeding up development as I am. As any Drupal user or developer will
with Drupal distributions. He explains how to tell you, Drupals flexibility allows for almost
automate some of the more repetitive tasks infinite possibilities, but also nearly infinite
a lot of developers struggle with. Then, Tim amounts of struggle. This issues aim is to
Loudon provides an in-depth look at the most help a lot with the latter and inspire much of
intriguing feature of the Trekk distribution, the former. Happy Drupaling!
which is aimed at Universities. Because many
universities struggle with combining legacy Katherine Druckman is an HTML-flinging, PHP-hacking
content from multiple sources, the team Linux Journal Webmistress by day and a refined connoisseur
behind Trekk developed Flatfish, an HTML of historic architecture and fine Chinese ceramics by night. She
scraping tool. Tim shows how it all works. usually can be found surrounded by the charm of aging Texas
For those who are newer to Drupal, some buildings from the pioneer days or appreciating ceramics of the
basic tasks can be very troublesome, but Song and Qing dynasties. Well, either that or sitting in a comfy
Danny Englanders tutorial on theming custom chair with a laptop. Yeah, probably the laptop thing. Now in her
content types will help a lot of beginners over sixth year heading all things LinuxJournal.com, Katherines
an initial hurdle. He walks through one of experiences in Web publishing for the open-source audience
Drupals best features and shows how to get have strengthened her stance as an impassioned Drupal fangirl.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 7

LJDrupalSupplement.indd 7 9/15/12 9:57 AM


OPINION
Dont Pitch Drupal
Sell Solutions to Real
Business Problems
Drupal is a transformational technology.
JEFFREY A. MCGUIRE

Theres a lot we can say about (http://techcrunch.com/2011/08/17/


Drupal and why you should choose red-hat-ceo-at-linuxcon-i-have-no-
to use it. It is built and constantly idea-whats-next), familiar to you as
improved by thousands of active the CEO of Red Hat, I immediately felt
developers, and is adopted by that we could say the same thing about
hundreds of thousands of users Drupal. When you read this now, try
around the world from governments substituting the word Drupal for the
to activists, NGOs to media word Linux:
conglomerates, universities to local
schools, big business, technology Linux is a transformational
companies, publishers and beyond. technology. The technology of
Whether you are new to Drupal, Linux empowers advancements
assessing using it for clients or for and innovations that have nothing
realizing your own projects, or for a to do with the technology of
world-changing vision, you should Linux. That is to say, Linux
know that there is a more compelling supports the development of
reason: Drupal is changing business new business models, as well
and the world. as new technologies.
This has happened before in
other open-source projects. More than 3,000 people took
The first time I read this quote the 2011 State-of-Drupal survey
about Linux from Jim Whitehurst (http://groups.drupal.org/node/175624).

8 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 8 9/15/12 9:57 AM


OPINION

When asked to describe Drupal in of effort that the Drupal community


one word, the overwhelming favorite has put into it: coding, bug fixing,
was flexible. This flexibility has improvements of all kinds, user and
given rise to a plethora of innovative menu systems, database query engine,
products built with Drupal. dynamic page buildingall solved and
much more.
What Are Drupal Products? Any of you who have installed
Products are collections of functionality plain-vanilla Drupal (http://drupal.org/
that solve a given set of problems; they download) know, however, that it still
are tools that get a job done. A tool that takes quite a lot of work to go from
helps your average personor geek, in that to a polished, finished Web site:
our caseget a job done better, cheaper, UX and IA planning, configuration of
faster or easier than other options has a Drupal core, adding and configuring
chance of succeeding. N modules, making it all look beautiful

Drupals enormous success is thanks to the fact


that it lets us build those toolscall them Web
sites, distributions or what have youbetter and
more efficiently than starting from scratch.
Drupal, my CMS of choice, is in the theme layer and so on.
itself a product. As Zach Chandler Drupal products take this a step
from Stanford Web Services said, further. They are solutions to business
Drupal is a tool-building tool problems, made by combining the
(https://www.acquia.com/resources/ worlds best CMS (there, I said it!),
podcasts/acquia-podcast-44-drupal-at- with the added value of specialist
stanford-and-beyond-zach-chandler). knowledge and best practices.
Drupals enormous success is thanks For the purposes of this article,
to the fact that it lets us build Im talking about Drupal distros
those toolscall them Web sites, instances of Drupal, preconfigured
distributions or what have youbetter for a particular purposebut
and more efficiently than starting Drupal plugin modules, themes and
from scratch. When you download features (pluggable functionality
and install Drupal, youre already and configuration sets) can all be
taking advantage of millions of hours products too.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 9

LJDrupalSupplement.indd 9 9/15/12 9:57 AM


OPINION

Some Drupal Products


Here is a small selection of Drupal products,
covering a fraction of the solutions people
are offering based on Drupal today.

Commerce Kickstart

E-COMMERCE
Commerce Kickstart is built on the Drupal
Commerce platform. Its an on-line shop in a box
(http://commerceguys.com/blog/just-released-
commerce-kickstart%E2%80%99s-first-beta),
giving you access to the growing e-commerce
market while saving you weeks of time configuring
the platform.

10 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 10 9/15/12 9:57 AM


OPINION

INTRANET
Open Atruim (http://openatrium.com) is an
intranet and team portal package. It comes with
a blog, wiki, calendar, to-do list, shoutbox and
dashboard to manage it all.

Acquia Commons

COLLABORATION
Acquia Commons (https://www.acquia.com/
products-services/drupal-commons-social-
business-software) is a ready-to-use solution
for building internal, external and cross-over
communities. It provides a complete social business
software solution for organizations to add the
social layer in the enterprise.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 11

LJDrupalSupplement.indd 11 9/15/12 9:57 AM


OPINION

COD

CONFERENCE AND EVENT ORGANIZING


COD (Conference Organizing Distribution,
http://usecod.com) is a complete conference
and event site that you can customize. It includes
e-commerce, session submission and voting tools,
multi-track scheduling and more.

12 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 12 9/15/12 9:57 AM


OPINION

OpenPublic

GOVERNMENT
OpenPublic (http://openpublicapp.com) is a
Drupal distro for government and policy groups.
Accessibility- and security-compliant out of the
box, it focuses on usability, transparency and
public participation needed in this day and age.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 13

LJDrupalSupplement.indd 13 9/15/12 9:57 AM


OPINION

Julio

EDUCATION
Julio (http://julio.funnymonkey.com)
is a distribution targeted for schools, school
districts, small colleges and academic departments
within universities. It features calendars, clubs,
teams, announcements, departments, staff
directories and more.

14 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 14 9/15/12 9:57 AM


OPINION

Videola

MEDIA
Videola (http://videola.tv) is an enterprise-level
video management system and video delivery
platform. Create paid-access or free-access video
Web sites with an impressive range of tools for
organizing and managing video content, users and
e-commerce.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 15

LJDrupalSupplement.indd 15 9/15/12 9:57 AM


OPINION

OpenPublish

PUBLISHING
OpenPublish is designed for the on-line news
industry (http://openpublishapp.com). It
contains a powerful suite of content, curation,
audience engagement and taxonomy tools to
build solutions for todays publishers.

16 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 16 9/15/12 9:57 AM


OPINION

SaaS
Theres quite a lot going on in the Drupal
Software as a Service (SaaS) area too.

Webform

Webform one of the most powerful form-


building and survey tools on the Web, all built on
Drupal, all open source (http://webform.com).
Pay to get simplicity, speed and service. Or,
because its all based on Drupal GPL code
(http://drupal.org/project/webform), you can
download and set something up yourself as well.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 17

LJDrupalSupplement.indd 17 9/15/12 9:57 AM


OPINION

Subhub

subhub, Drupal Gardens and Buzzr three


different Drupal-in-the-cloud providers, offering
a range of services (maintenance, design,
support and so on) and options for end users and
other service providers (http://www.subhub.com,
http://www.drupalgardens.com and
http://www.buzzr.com). Drupal Gardens
and Buzzr prominently offer no-lock-in
guarantees and tools for large stables of sites.

18 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 18 9/15/12 9:57 AM


OPINION

Drupal Gardens

Buzzr

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 19

LJDrupalSupplement.indd 19 9/15/12 9:57 AM


OPINION

Six Ways Drupal Products Can are customizable, extensible and


Help You compatible with all the rest Drupal
Here are some ways a Drupal product has to offer. Drupal SaaS offerings are
can help. Some of these might apply to something of an exception to this, but
you more than others, depending on they have other benefits.
whether you work with and sell Drupal
services, are considering adopting Common problems! Until recently,
Drupal or want to build your own Drupal didnt have an official
Drupal product. roadmap (the Drupal 8 initiatives,
http://buytaert.net/mobile-for-drupal-8,
Efficiency! Experience! Expertise! are a first for Drupal in this respect),
I already mentioned that using Drupal relying on thousands of geeks taking
gives you a big head start. Now add advantage of the scratch your own itch
expert knowledge and experience to principle allowed by the four freedoms
the mix. The people who build Drupal (http://en.wikipedia.org/wiki/Four_
products to fulfill the needs of a given Freedoms_(Free_software)#definition)
segment have gone the extra mile to add functionality and innovation. I
to give you their insight into it and call this the water rolling downhill
solutions to its problem spaces. model of development: 99% or more of
If you need a specialized site, one business problems are non-unique, so
of the advantages of distributions the water flows where it is needed. In
is that they often are maintained by Drupals large repository of contributed
companies you can hire for support or modules (http://drupal.org/project/
customization. modules), you are likely to find one or
If you are building a site based on more modules that provide any given
a specialized distro, you get all that functionality youre looking for. If the
experience at minute zero of your contrib repo is a sunny day, the lenses
project too. Combined with everything that focus this potential into fire-starters
Drupal brings to the table, it all adds are Drupal products. They combine, test
up to a huge head start that multiplies and refine functionalities into solutions
your own knowledge, expertise and for common problems.
service offerings.
Help with demos! If you offer
Customize to your hearts content! Drupal site-building services, not all
On top of all that a Drupal product of your prospects have your vision
brings to the table, distributions and understanding of Drupals massive

20 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 20 9/15/12 9:57 AM


OPINION

potential and power as a tool-building Specialize! Hey, you know a lot about...
tool. Not every kid sees the castle, something! Maybe it's hotel management
spaceship or city in a giant tub of (http://drupal.org/project/rooms),
LEGO bricks. Instead of showing out- real estate (http://groups.drupal.org/
of-the-box Drupal and promising real-estate) or dentistry. Be the expert.
Theres a module for that, show Multiply all the value described above
them the picture on the LEGO box! by your own expertise. Build a Drupal
Drupal products look like what they product once; reuse it N times! This
do: Julio looks like a school Web site; is a great business model followed by
Drupal Commerce Kickstarter 2 looks many successful Drupal shops and other
like an on-line store. Reduce the businesses around the world, whether
amount of effort needed to visualize you sell services based on your distro
the final result, and you will reduce or simply want to accelerate your
the amount of convincing you need site-building business.
to do to turn a prospect into a happy,
Drupal-using customer. Dont pitch Drupal! Finally, Drupal

2012 #1 Software Vendor and #8 Fastest Growing Overall

Introducing a free tool


for Drupal users Instant Insight
Grade your site on performance,
security, SEO, and Best Practices.

Go to https://acquia.com/instant-insight,
enter your URL, & get a free site scan

LJDrupalSupplement.indd 21 9/15/12 9:57 AM


OPINION

products allow you to avoid the biggest with solutions-based approaches. Red
mistake most Drupal business people Hat is a great example of thisdoing a
make: selling the Drupal value proposition billion dollars of business in 2011 with an
as if others cared about Drupal. You should open-source, solutions-based business.
help them understand the advantages of Take a look at this video:
an open-source CMS that has reached http://www.youtube.com/
critical mass resulting in innovation, risk watch?v=OJtQeMHGrgc. That was Steve
mitigation, cost reduction and future- Jobs in the very first Apple store before it
friendliness (http://www.lukew.com/ opened in 2001. Heres what he said:
ff/entry.asp?1407). But, putting it
bluntly, Drupal is just a means to an end, The center half of the store...
so: dont pitch Drupal; sell solutions to is devoted to solutions because
real business problems. people dont just want to buy

Finally, Drupal products allow you to avoid the


biggest mistake most Drupal business people
make: selling the Drupal value proposition as
if others cared about Drupal.

Does a Focus on Solutions Work? personal computers anymore,


In 2001, one company had the vision to they want to know what they can
focus on selling solutions: Apple. Given do with them, and were going
that Apple now has more money in the to show people exactly that.
bank than most countries, we can say it Weve got four sections, and the
paid off. solutions weve chosen to feature
Note: much of Apples business model for now are music, movies,
relies on being closed and proprietary, photos and kids....You can bring
which goes against the values we live your kids into our store and they
by in the open-source world. The point can just sit a spell, play their
of this example is that it shows how favorite games, and...we have the
successful selling solutions can be. I best selection of Mac education
am convinced we can be even more software that Ive ever seen, and
successful, combining the collective you can buy the best educational
power and innovation of open source titles for your kids.

22 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 22 9/15/12 9:57 AM


OPINION

Just like Jim Whitehursts statement about that Drupal can fulfill their needs....
Linux mentioned earlier in this article, this Today, we have the best selection
inspired my thoughts about Drupal: of Drupal products, distros and
features that Ive ever seen, and
Our business is devoted to you can implement and customize
solutions because people dont just them to suit your needs.
want a CMS anymore, they want to
know what they can do with it, and Dont sell Drupal. Sell solutions to real
were going to show people exactly business problems.
that. Weve got four sections, the
Drupal solutions weve chosen to Jeffrey A. jam McGuire, Acquia Manager of Community Affairs,
feature for now are e-commerce, has a long-standing passion for Drupal and its community.
social business, government and He promotes and advocates for the Drupal project and
education (etc.)....You can show open-source software. Presenting around the world at Drupal
your prospective clients one or and other events helps satisfy his inner diva, which he also
more Drupal products, and they feeds with performances as a storyteller, singer, french horn
can just sit a spell, understanding and alphorn player. Tags: Musician, foodie, Drupalista....

Attend a Attend a

DrupalCon Drupal Business Summit


Expanding the Drupal circle

M
So Paulo - December 6-8, 2012 Dallas (09/07)
Sydney - February 6-9, 2013 San Diego - Higher Ed (10/11)
Y

CM

MY
Portland - May 20 - 24, 2013 Atlanta (10/26)
CY Prague - September 2013 Boston (11/15)
CMY

association.drupal.org/drupalcon DrupalSummit.com

LJDrupalSupplement.indd 23 9/15/12 9:58 AM


FEATURE Drupal Is a Framework

DRUPAL
IS A
FRAMEWORK
WHY
EVERYONE
NEEDS TO
UNDERSTAND
THIS
Everyone planning and building
Web solutions with Drupal
benefits from understanding
what a hook isand
why Drupal is not a CMS.
DIANA MONTALION DUPUIS

24 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 24 9/15/12 9:58 AM


O
ne of the greatest challenges shared by the Drupal community and can
that Drupal adopters face, be added to any Drupal site.
whether they are new site Some tasks require writing custom
owners or beginning developers, is code, and new modules must be built.
figuring out what is easy and what is Layers of potential functionality are
hard to do with Drupal. As a developer, involved in custom features. Some
solution architect, technical strategist features require communicating back and
and even as the friend who knows stuff forth with other sites via an application
about Web sites, 60% of my discussions programming interface (API). Bigger
revolve around three questions: how long Web sites often require the creation of
will it take, how much will it cost, and small applications that accomplish tasks
can my site do [insert cool new thing]? in the background, outside Drupals

Everyone involved needs to understand that


they can architect a Drupal site that offers
a more-sophisticated set of features than
a WordPress site, because Drupal is not a
content management system (CMS); it is
a content management framework.

Sometimes, these are easy questions usual workflow. In many cases, multiple
to answer. Many content-related tasks solutions exist, and choosing one involves
can be accomplished simply by logging in giving something up to get something
to Drupal, visiting the /admin page and else. As a developer or a stakeholder,
clicking on menu links until you land on finding the best solution that meets
the necessary administration page. business goals and stays in scope
More often though, there are depends upon cooperative discussions.
complicated questions to answer. Some That is where communication often
tasks can be accomplished by adding breaks down. Developers are speaking
contributed modules that easily plug in one language while site owners, project
to Drupal core, as it comes out of the and account managers, stakeholders
box, and expand a sites functionality. and others involved in the decision-
Contributed modules are created and making process speak another language.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 25

LJDrupalSupplement.indd 25 9/15/12 9:58 AM


FEATURE Drupal Is a Framework

When people first learn about Drupal, single text documents containing
their initiation often focuses on what everything you saw on the page, except
a node is, what blocks, content types for images, in one text file. The file
and views are, and how to create included HTML tags describing the
SEO-friendly URLs. These concepts are type of content being displayedfor
important, but they frequently fail to example, <p> denotes a paragraph,
answer the essential how hard is this and <h1> is a big headline. Browsers
to do question or provide a strong (which took ten hours to download)
foundation for collaborative planning translated this markup and presented
of more complex functionality. Everyone pages with a readable structure at a
involved needs to understand that they Web address dictated by the filename.
can architect a Drupal site that offers a The document would be uploaded to
more-sophisticated set of features than the server and saved in the Web sites
a WordPress site, because Drupal is not a primary folder. The filename page.html
content management system (CMS); it is then could be viewed using the browser
a content management framework. at yoursitename.com/page.html.
Conceptualizing Drupal as a framework If you wanted to change the Web pages
does not require years of programming content, you edited that file. If you wanted
experience; rather, it simply requires to change something in the header that
understanding what a hook is and appeared on all of the sites pages, you
finding out whether the one you need had to edit every page. Whether linking
exists and already is able to do the thing content together or displaying a similar
you want done. sidebar, content was laid out individually
To understand hooks, its necessary to on each and every page by hand.
understand how dynamic Web pages, Nowadays, most sites are dynamic.
delivered by Web applications, differ from Small programs, called Web applications,
static pages. Most tech-savvy people take are uploaded and stored on the server.
this knowledge for granted, especially Instead of delivering a static page to
Linux aficionados and those whose first view, the program runs when the browser
desktop computer had a flashing cursor at lands on the page, applying logic to
a C: prompt. But many people dont know the page creation process. This logic
how Web sites do what they do. (Why dictates how the page is built each time
would they?) Here is how I explain the a page is requested (also called on
difference in laymans terms. page load). For example: the program
In the olden days, static pages were gets the header, gets the main menu,

26 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 26 9/15/12 9:58 AM


gets the pages unique content, gets the and they are attached to the end of the
footer and delivers the whole page to the URLfor example, yoursitename.com/
browser. As a result, now there can be ?q=1234. Drupal uses a modified (no
one editable header, one footer and one less mystifying) address structure:
menu shared among all Web pages. yoursitename.com/node/1234. In both
What about the pages unique content? cases, the unique ID, the row number of
How does the application get that? the pages content, is there: 1234.
Imagine a spreadsheet where each row Web pages displaying semantic
represents each pages unique content. URLs, like yoursitename.com/
Dynamic Web sites store content in growing-a-container-garden, have
this way. They use a database, which included logic that pairs the unique ID
can be imagined as a collection of with the words. But for each page, a
spreadsheets, called tables. Each table, unique ID still exists and is associated
like a spreadsheet, has columns and rows. with the content in a database table.
Each row has a unique ID. When a page With the advent of dynamic Web
is displayed, the content associated with applications, the continual development
that pagean article about container of the programming languages and
gardening, for exampleis retrieved from databases needed to drive them, and
the database table and output to the page. the worlds voracious need for more
In Drupals case, the programming and more content-rich sites, voilthe
language PHP supplies the logic and Content Management System (CMS)
MySQL provides the database. Usually, was born. Drupal is a CMS insofar as
the operating system installed on the it is an application that saves content
server to power this process is Linux, to a database and displays it to a page
and Apache is the software that handles using logic that is written into its core
the requests for pages and delivers them or added by programmers. But Drupal is
once they are built. This software bundle not (really) a CMS; it is a framework that
is called the LAMP stack. does CMSey stuff. Drupal provides
Without static filenames like about.html, the structure for Web applications, far
how does a dynamic Web site know more complex than a CMS, that do all
which row from the content table the things Web sites can do: expand
to display? Drupal, like other Web the functionality (using contributed or
applications, uses a query string to custom code), communicate with other
match the content to the page address. Web applications, run applications
Query strings look like this: ?q=1234, written in PHP and other languages

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 27

LJDrupalSupplement.indd 27 9/15/12 9:58 AM


FEATURE Drupal Is a Framework

behind the scenes, provide responsive n Q: Who are you (specifically)? A: Start
pages or integrate front-end languages, a session.
scale to handle large traffic numbers by
making use of server technologies and n Q: What are your requirements?
provide the foundation for other as-yet- A: Create server/browser page headers
unthought-of innovations. (the parameters for further relating).
Heres where the process gets ingenious.
But, there is one more conceptual step n Q: Where are you?
to take before its clear that hard or easy A: Select language.
depends on hooksbootstrapping. Again,
this is a concept that may seem like Finally, Drupal delivers the content:
common knowledge to the tech-focused
reader, but it can be tongue-twisting to n Q: Which page? A: Serve up the page.
explain. Here is my laymans version,
which is an oversimplification, but a This is the sweet spot, the place
deeper understanding isnt a prerequisite where most (but not all) of the hook
to understanding hooks. magic happens.
When a browser hits a Web page, Hooks are little blocks of functionality,
Drupal asks a series of questions. The called functions, that contain PHP code.
question process is called bootstrapping. These blocks of code run when they are
The questions (Q) trigger actions (A). called upon. During the bootstrapping
process, especially when the final which
n Q: Who are you (generally) and what page? question is asked, hooks are
do you want? A: Initialize and store called. Whenever an event happens in
general info. Drupal, like deleting a page, hooks are
called. Inside those hooks, there is code
n Q: Can I just give you a stored copy? that alters functionality, and it runs
A: Serve cached data (content stored as soon as the hook is called. Almost
in memory). anything you want Drupal to do has a
hook doing it.
n Q: Can I connect to the database? Drupal relies on naming conventions
A: Do so or die. to call hooks when the time is right for
them to run. While building the menu,
n Q: Do I need anything from there to Drupal looks for hooks with _menu in
work? A: Get it. the name. When a page is deleted, hooks

28 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 28 9/15/12 9:58 AM


with the name _delete are called. n Drupal provides an administrative
Drupal modules override existing hooks interface for you to turn it on or
or add new ones. For example, if I want to change it.
change the way a form is displayed, I put
the code for that change inside a function n A module or theme already has been
called mymodulename_form_alter. written, calling or adding the hooks
When the forms page is built, Drupal (with the necessary code inside them)
will look for any _form_alter function that you need.
to see if there is more to do. I also
can create new hooks in custom code n Custom code must be written (using
that can be called by other hooks, or creating hooks and adding code to
mymodulename_myhook. them). The time and effort required
Hooks dont just govern behavior. The here varies widely, from three quickly
theme, which is the collection of files written lines of code to months of
specifically dictating the sites look and programming, creating multiple
feel, also includes hooks. The front end contributable modules.
of a Drupal site (the presentation rather
than the behavior) is not simply painted n Custom database tables must be
on; it relies on hooks as well, all being created. At this level of complexity,
called when Drupal delivers a page. the code still will rely on hooks
Remember our three original questions: but begins to run outside of what
how long will this take, how much will Drupal does natively; therefore, it
that cost, and can my site do [insert is (sometimes) more complex than
cool new thing]? The answers, and adding code alone.
whether something is easy (quick, cheap
and already possible) or hard (time n Necessary data comes from other
consuming, expensive and innovative), Web sites, or your sites new feature
depend on hooks. I would like my site requires communicating with other
to do X. Is that easy or hard? The scale sites (for example, credit-card
from easy to hard looks like this: processing). The time and effort to do
this also varies widely and can be as
n Drupal already does what you want easy as adding a module (that already
it to do because the necessary handles this communicating) or as
hooks, with the necessary code, hard as writing a separate application
run by default. that runs when the appropriate

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 29

LJDrupalSupplement.indd 29 9/15/12 9:58 AM


FEATURE Drupal Is a Framework

hook is called. What your site will do releases, blog posts and so on. An admin
with the data and the load it puts interface in Drupal 7 makes creating
on the system greatly influences the nodes (the foundational content type
complexity as well. with a title and body) and adding fields
of related data to them, like the author
n Your tasks cant run on page load, a and publisher in a book review, a code-
special process has to be written to free task. Creating book reviews that
accomplish them. Sometimes, this is include a cover image, author, publisher,
a quick addition (a simple cron job publication date and a link to Powells
using hook_cron), and sometimes this City of Books is quick. Adding a five-star
is complicated. Often, this approach rating to each review involves adding one
is used when data processing would contributed module and turning it on.
slow page load down (or take down How hard it is to make the review
the site), so it is handled out of look like the design depends on how
sync and saved (cached), serving the much the design varies from the way
cached version when the page loads Drupal presents the content to the page.
and the question is asked. If the author, publisher and so on will
be displayed in the order it was created
Does Drupal already include the administratively and styled according to
necessary hooks running the necessary the sites general style guide, creating
code and does it provide an admin the look and feel involves adding some
interface to set up what you want to CSS to the themes CSS file(s). Easy! But
accomplish? Easy! Do you need to get if the page will distribute the fields in a
mega-amounts of data from elsewhere, unique order or include custom behavior
process and save it out of sync with page (like also displaying other books the
load, and create new database tables user has rated), custom work needs to
that interact with existing data? Hard! be done. Hooks in the modules and in
Drupal core and many contributed the theme enable this work to happen,
modules are primarily designed to allowing the page load process to be
manage content, to power a CMS interrupted and edited.
which is why it is right to say, from one Ironically, the fact that Drupal enables
point of view, that Drupal is a CMS. Out the creation of a book review content
of the box, users can create any content type is also what makes it a framework.
type imaginablebook reviews, recipes, In the words of Larry Garfield, Drupal
scholarly paper submissions, press core contributor and member of the

30 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 30 9/15/12 9:58 AM


Drupal Association Advisory Board: implemented and making collaborative
decisions with site owners is the fine
What Drupal is today is a tool for art of managing development, the place
building a content management where the conversations begin again.
system for a variety of different This process is made easier, every time,
needs. Thats an important when everyone involved understands
distinction for someone how Drupal works (framework!) and
looking to build a Drupal site trusts the easy/hard assessments made
to understand. Drupal is not by the development team.
a CMS. It is the framework Hooks create, define and override the
with which you build your own Drupal tools used to build information
CMS, to your specifications, to architectureassociating content with
suit your needs. It is a Content other content and creating navigable
Management Framework. structure. Nobody wants a Web site to

Nobody wants a Web site to spit out all


of the content in one big blob.

Diving into the syntax of hooks does spit out all of the content in one big blob.
require programming knowledge and is, The primary tools to build information
in my experience, where the discussion architecture are content types, menus,
between developers and product owners blocks, taxonomies and views.
should end. My developer cohorts
and I discuss the technical aspects of n Nodes, content types and fields give
implementing hooks: which to use, structure to the content. Fields (like
where to put them, when to call them, author or publisher) make for easy
how to simplify the code they run, content creation and visual continuity
performance issues and caching plans, for the user.
the decision to use contributed code or
write my own. Once the decision to, for n Menus enable navigation by creating
example, pull in feeds and display them a structure of associations. Menus
is made, the how discussions begin. create a content geography and reveal
(Node.js anyone?) Communicating the the paths for exploring it without
issues that arise as the how is being getting lost.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 31

LJDrupalSupplement.indd 31 9/15/12 9:58 AM


FEATURE Drupal Is a Framework

n Blocks are boxes of content that can alphabetically. The lists often are
be associated with and displayed created using the Views administrative
in a region, such as the sidebar or interface, but custom code can
footer. These boxes can be filled override the output (hooks!), and
with any kind of content: nodes entire views can be created in code.
and content types, menus, lists, text
with markup, output like feeds or The Drupal framework is a kitchen
unique code-created lists like most where, yes, there already are tools
recommended. There are hooks, of in the drawer and ingredients in the
course, to create, control, edit and pantry. But those tools and ingredients
override blocks, although most blocks do not define the meals that can be
are built administratively. made there. Teams of site owners,
stakeholders, project managers,
n Taxonomies are lists of terms that business-goal definers and developers
can be associated with content. Most can cook better meals together when
users are familiar with the idea of Drupal is understood as a framework.
tagging, associating a blog post Approaching Drupal as a CMS often
(for example) with a list of terms like means bending it to your will: I want
coding, biking, cooking or hiking zucchini muffins like my mother used
In Drupal, taxonomies can provide to make; do that. As a framework,
the foundation for more-complex use Drupal encourages creating the best,
cases, but associating content is the most-elegant recipe within the scope of
most common. the endeavor: Heres some zucchini,
what can we do with this?
n The Views module is a list-maker, Drupals flexibility may make answering
powered by a contributed module. our three questions (how long, how
Many complex tasks can be handled much and can it be done) more time
by Views, but at its most basic, its consuming. But in the end, the outcome
the way to create a list of content is far more satisfying.
in Drupalfor example, all book
reviews posted in the last three Diana Montalion Dupuis is a software developer, Web
months. Views also can display strategist, writer, trainer and hiker who doesnt spend
content using associations, such as enough time in the mountains. She lives in Austin, Texas,
all posts tagged with the taxonomy where it is too hot in the summer, and is Director of
terms apple and spinach, sorted Development and Professional Services at Four Kitchens.

32 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 32 9/15/12 9:58 AM


If You Use Linux, You Should Be
Reading LINUX JOURNAL

 In-depth information
providing a full 360-
degree look at featured
topics relating to Linux
 Tools, tips and tricks you
will use today as well as
relevant information for
the future
 Advice and inspiration for
getting the most out of
your Linux system
 Instructional how-tos will
save you time and money
Subscribe now for instant access!
For only $29.50 per yearless
than $2.50 per issueyoull have
access to Linux Journal each
month as a PDF, in ePub & Kindle
formats, on-line and through our
Android & iOS apps. Wherever you
go, Linux Journal goes with you.

SUBSCRIBE NOW AT:


WWW.LINUXJOURNAL.COM/SUBSCRIBE

LJDrupalSupplement.indd 33 9/15/12 9:58 AM


FEATURE Drupal Distributions

DRUPAL
DISTRIBUTIONS
Working the Linux
Model Up the Stack
The ability to download and run a complete Drupal application
easily is being heralded as a new era that is completely
transforming how people use Drupaland the Web. In this
article, I discuss how Drupal distributions are made,
how you can use them, and how to add your own
distribution to drupal.org.

FOREST MARS

34 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 34 9/15/12 9:58 AM


I
n the eight years since Linux Drupals evolutionary arc, in many
Journal switched over to Drupal ways, recapitulates the history of
(that fateful Halloween morning Linux development, with the adoption
in 2004), the Drupal project has of more automated build tools and
undergone explosive growth, maturing package management systems giving
from a small but powerful content rise to a victory garden of different
management system into an enterprise- distributions. Drupal distributions
class development framework powering are based on installation profiles,
some of the largest sites on the Web. which date back to around the time LJ
This process has been driven by a highly switched over its site, and preceded the
collaborative ecology later augmented existence of Drupal shell tools, such as
by the ability to bundle up completed drush and drush make.

Drupals evolutionary arc, in many ways,


recapitulates the history of Linux development,
with the adoption of more automated build tools
and package management systems giving rise
to a victory garden of different distributions.
sites and pass them around for use and First, a Little History
further development. Around the time of Drupal 4.5 (the
In this article, I look at the big version Linux Journal used when it
picture of this Drupal evolution and launched its Drupal Web site), the need
where its going (so that LJ readers can was recognized for installation profiles as
better anticipate whats coming) with a way to focus the highly configurable,
an emphasis on how the underlying but largely baffling initial experience
architecture is giving rise to a with Drupal into something that could
distribution-based development ecology be used and adopted easily by both
(in many ways reminiscent of the individuals and groups. Back in the day
heyday of Linux distros) and explain when the Drupal learning curve was more
how to leverage existing Drupal like a learning brick wall, the idea was
distributions as well as build your own. to make Drupal make sense to first-time

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 35

LJDrupalSupplement.indd 35 9/15/12 9:58 AM


FEATURE Drupal Distributions

users and to allow it to be used to meet was more like a formula than a
their needs without all the unnecessary completed thing. It included a list of
complication. sub-components that would be needed
CivicSpace was one of the very first in addition to Drupal core (which
distributions, although it wasnt wasnt itself even included), such as
necessarily a distribution in the specific modules, themes and a profile file that
sense in which the term is used in contained scripts required to execute
Drupal today. Aimed primarily at political predefined functions and configure the
campaigns, it was the one that started completed site.
it all, demonstrating how the Drupal Building an installation profile
CMS could be used to build an easily required considerable knowledge of
expanded, complex distributed network Drupal APIs and a fair amount of time

Imagine if you had to manage dependent


libraries on a Linux server this way;
its not surprising that it never took off
as quickly as some had hoped.
of sites that all communicated with each and dedication. In addition to merely
other. It even included integration with having to assemble manually the list of
CiviCRM, which was considered pretty the modules that were needed for the
advanced for the time. particular installation, you had to write
It wasnt a distribution in the your own custom installation scripts.
contemporary sense but more correctly These scripts invoked PHP functions
an installation profile. Back then, both that could be fired in place of Drupals
terms had different meanings from what default installer and were needed to
they have today (as the process has been manage the additional configuration at
greatly improved), but all along there install time. Since this was before CTools
has been the goal of facilitating a way to and the Features module allowed you to
share Drupal site recipes and complete define exportables, there was no way to
installations easily. prepackage the configuration; you had to
In those days, an installation profile do it by writing custom scripts that built

36 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 36 9/15/12 9:58 AM


the configuration in real time, essentially techniquesone that borrowed heavily
compiling a working site, but from from approaches to Linux development.
executable code, not configuration flags. Drush is a tool that lives outside the
The final step of using this install Drupal installation. Installing it on a
profile to generate a finished site Linux system is as easy as curling it to
although not involving code writing the right directory. Drush also can be
was also a bit tedious. The installation installed via Debian package management
profile wasnt a complete distribution, (http://packages.debian.org/sid/drush)
but included a list of everything you or by using its custom PEAR channel:
would need to get to put it together.
You then had to download Drupal core $ pear channel-discover pear.drush.org
separately, as well as the .profile itself, $ pear install drush/drush
and then individually download each and
every one of the modules. Imagine if you Drush can interact with nearly every
had to manage dependent libraries on a aspect of the Drupal API and has rapidly
Linux server this way; its not surprising grown in popularity, expanding to be able
that it never took off as quickly as some to do more and more using succinct and
had hoped. Then, you still had to run direct invocations and arguments. Using
the installation profile scripts to stitch drush to download every module needed
it all together, and, if all went well, for a given profile meant speeding things
youd have an up-and-running custom- up a little, but the giant leap forward
configured Drupal site. was made possible by the release of
drush makeessentially a build script
Enter Drush (Drupal Shell) that accepts a structured manifest with
The introduction of drush or drupal shell instructions for compiling a specific
(http://drupal.org/project/drush), a working Drupal installation. (Of course,
command-line shell and scripting tool, it isnt strictly compiled in the technical
completely changed all that and more. sense, but the metaphor holds.) This
At the very least, it made possible far- makefile (or dot makefile) is a text-
reaching changes in Drupal development based configuration file using Drupals
practices. By providing a set of tools that .info format (derived from PHPs .ini
allowed nearly every aspect of Drupal format) thats essentially a list of all the
development to be done completely from required/needed subcomponents. This file
within a shell environment, it created a describes all the components needed to
foundation for further advancements and assemble a full Drupal installation profile,

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 37

LJDrupalSupplement.indd 37 9/15/12 9:58 AM


FEATURE Drupal Distributions

where to get them, how to get them and that allowed you to use Drupal to do
even what patches need to be applied. something that wasnt strictly possible
Just a few short months after the with vanilla core: running it on a reverse
first version of drush make was released proxy server to be able to scale site
in mid-2009, it was used to create a performance. This advancement ushered
Drupal distribution called Managing in a whole new era of highly performant
News, which prior to that had been Drupal sites able to serve up content at
a downloadable package, but was Web scale, and was later included by
not based on any universal package default in Drupal 7.
management framework. With the Pressflow also diverged in the sense
adoption of drush, it became the first of being a completely packaged Drupal
install profile to include a makefile. This install containing all components, as
was somewhat of a watershed moment opposed to a manifest that you had to
for Drupal, as it was the first Drupal build with drush, anticipating the Drupal
installation profile that automated the distribution era. A full distribution
build process, instead of requiring you doesnt need anything to be fetched
to go fetch all the components yourself. over the network but includes all
After this, the genie was out of the components in a single bundle, vastly
bottle. Drush make allowed installation simplifying the process of circulating
profiles to be assembled and served finished Drupal sites with complex
up as a single downloadable tarball, sophisticated functionality.
instead of requiring the user to go fetch
all the pieces individually from different Distributions on Drupal.org
locations and put them all together. In December 2009, drupal.org updated
The next important milestone was its infrastructure to integrate the drush
Pressflow, which wasnt technically a make tool as a packaging system (in
distribution, or even an profile, but large part due to the work of Derek
a retooling of Drupal 6 to make its Wright). Up until that point, there were
HTTP headers compatible with the no distributions on the main site, but
Varnish reverse proxy server. Pressflow only installation profiles. The integration
was important in that it wasnt just of drush make turned drupal.org into
a collection of Drupal features aimed an on-line package management system
at a specific interest group (in fact, it that automated the process of turning
included no bundled modules at all) a Drupal site manifest into a finished
but was purely a technical distribution Drupal tarball ready for download.

38 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 38 9/15/12 9:58 AM


Internationalism blazed the trail, profile was a list of dependencies the
providing one of the first true user had to retrieve manually with a
distributions to be made available there, script or set of scripts that ran ancillary
with the stated goal of making it easy to the default installer script (install.php),
just to install a language-localized version which provided a number of places
of Drupal with no manual intervention for them to hook into or override the
or additional configuration whatsoever. standard behavior. Nowadays, an install
Since then, the Internationalism distro profile is thought of as a specifically
(aka i10n) has continued to surf the formatted set of manifests that are
edge; the latest version can be found at executed by the Drupal 7 installer that
http://drupal.org/project/l10n_install. can optionally invoke ancillary scripts,
Note: one important distinction which may be less necessary for distros

Install profiles come packaged with distributions


in the sense that every distribution has at least
one install profile, but an install profile by itself
is not a distribution.
between distributions and installation that are mainly bundled features.
profiles (in the older sense of the term) Thus, an install profile technically
is that not all distributions can be made has essentially the same meaning it did
directly available on drupal.org, because originally; however, the way its used has
there is no third-party code hosted there. changed as the packaging system and
Those distributions bundling third-party drupal.org infrastructure has evolved.
code will have to be content with having Install profiles come packaged with
only their manifests there and/or making a distributions in the sense that every
full tarball (or zip file) available elsewhere. distribution has at least one install
Its also important to note that profile, but an install profile by itself is
the terms installation profile and not a distribution. Drupal 7 is the first
distribution have morphed in meaning version to ship with more than one
as the development process has become installation profile from which to choose.
more defined. Originally, an installation Properly speaking, a distribution is a

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 39

LJDrupalSupplement.indd 39 9/15/12 9:58 AM


FEATURE Drupal Distributions

full copy of Drupal packaged together Drupal distributions improve the factory
with the additional modules, themes model when you need to able to spin
and scripts that give you everything you up or deliver Drupal solutions quickly
need to produce a complete and complex and efficiently, and like the original
Drupal Web site in a single downloadable installation profiles that gave rise to
file. Its a ready-made tarball (or zip) them, they are especially effective at
thats completely self-contained. meeting a widespread use case (just as
they are much more efficient at meeting
The Distribution Advantage it). Essentially, distributions finally realize
The now outmoded method of assembling the vision of install profiles both in terms
all these components manually was a of vastly improving the Drupal experience
tedious process and one that required and facilitating an ecosystem now heavily
you to know a good bit about Drupals populated with hundreds of distros of every
terminology and file structure, not to stripe and color, such as the Spark distro,
mention having to implement all the which brings in-place editing to WYSIWYG
required function calls yourself. The process content management; Open Atrium, an
was repetitive and predictable, which made extremely popular groupware/intranet
it a great target for automation. In addition (the Whitehouse uses it as an internal
to the main benefit of automation and ease, collaboration tool); DataPublic, for creating
distributions can provide: open data portals; a paste-bin distro; a
port of Joomla called GLORilla; and the
n Increased development speed. official TedX Web site, just to mention a
few of the hundreds of freely available
n A clean way to install your site and be distros, from educational to corporative,
able to hand it off to others. from scientific to religious, all of which
can be downloaded directly from
n The increased ability to compete with http://drupal.org/project/distributions.
commercial turnkey solutions. Note, however, that Drupal doesnt
have a defined way to separate upstream
n An ecology that encourages and local configuration and settings.
collaborative development and Theres no /usr/local, and apart from
community involvement. workflow-based solutions, its a missing
piece that arguably would be of great
n A platform to invent new markets benefit to making Drupal distributions
heretofore unthought of. even better.

40 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 40 9/15/12 9:58 AM


Whats Included in a awesome Drupal site that other people
Drupal Distribution? would be interested in downloading and
Distributions are essentially finished using. You can use an existing distribution
installation profiles. The basic components as your starting point, building on the
of a distribution are Drupal core plus any work of others. For example, Panopoly
of the following additional components: (http://drupal.org/project/panopoly)
is an Apps-enabled distribution of Drupal
n Installation profiles. designed to be both a general foundation
for site building and a base framework
n Contributed modules and themes. upon which to build other Drupal
distributions. After you have a completed
n Distro-specific features, modules site, youre ready to package it up for
and themes. sharing. The site from which youre making
a distribution could be a clean install of the
Just to be clear, a distribution is an architecture youve built (meaning it could
install profile, packaged with Drupal have no created content yet), or it could be
core and any required contrib modules. a full site with content thats been created
The install profile that comes with a by multiple users. The distribution build
distribution may in fact have additional process will pack up only the modules,
scripts that run at installation time in not any of the configuration, content or
its .profile file. Although distributions users. To include configuration, youll need
and installation profiles seem very to write a .profile with bundled scripts
straightforward once you understand (or capture it all in Features). To provide
how they work, you may find the default content or even users out of the
terminology seemingly inconsistent, box, youll have to use the Profiler module
both in the official documentation and (http://drupal.org/project/profiler).
elsewhere. Building your own Drupal The second step is to generate the
distribution, however, and showcasing makefile. This file is a manifest specifying
it on Drupal, isnt too complicated. The the version of Drupal core that is needed
following is a short guide on how to roll to build the site (if none is given, the latest
your own drupal distro and submit it. stable release will be used) along with a
list of all contributed and custom modules.
How to Make Your Own Contrib modules optionally may be given
Drupal Distribution a version number, and custom modules
The first step is, of course, to make an generally will need to have a path to a

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 41

LJDrupalSupplement.indd 41 9/15/12 9:58 AM


FEATURE Drupal Distributions

repository to download them from, such as (Note: this step can take several minutes
GitHub. (You also can use a repository other depending on the size of your site.)
than drupal.org for contrib modules, such At the completion of this step, you will
as running your own local repository to have a finished Drupal distribution that
speed up package retrieval.) The easiest way anyone can use to spin up an instance
to generate the basic site manifest is to use: of the kind of Drupal site youve built,
without downloading anything additional
$ drush make-generate my-site-name.make over the Internet. You could offer it for
download at the site of your choosing,
which will auto-generate the drush or you could put it on a site specifically
makefile based on your current site dedicated to showing off your distribution
configuration. For any information it cant and making it available for download.
find (the path to a custom repository, for You even could add your custom distro
example, which isnt stored anywhere else to the growing number available for
in configuration), it will insert placeholders download directly from the drupal.org
reminding you to fill this in manually. And, Web site. However, to do this, you wont
of course, if youre using alternate or dev submit a full package made with the
versions of any contrib modules, they will prepare-install command, but instead
be included too. Inspect the file it created generate the makefile only:
for you and make sure any placeholders are
replaced with corrected paths. (Covering $ drush make --generate-makefile drupal-org.make

the exact syntax for each of these entries is


outside the scope of this article.) (Note: at the time of this writing,
Note that drush make handles only you do have to make one manual edit
modules and libraries (downloadable to this file. See http://drupal.org/
code) and not the configuration stored node/642116 for instructions.)
in the database (including content types Then, verify that your makefile is
and so on) for which youll need a ready using:
manually built install .profile or bundled
features (using the Features module). $ drush verify-makefile
The next step is to execute your
makefile to prepare your distribution Finally, youll want to execute the
using the prepare-install command: makefile locally (just to confirm its
working) and then commit the manifest
$ drush make --prepare-install --tar my-site-name.make my-site-name only (that is, the drush makefile, not

42 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 42 9/15/12 9:58 AM


the fully packaged distribution) to the For full details on submitting your distro
distributions repository using Git, the to drupal.org, see http://drupal.org/
version control system used on drupal.org node/642116.
(and created to manage the Linux
kernel). To release a distro on drupal.org, Forest Mars is a hypermedia architect probably best known
you will need the ability to create full as the founder of New Yorks first and only free Internet
projects there, which involves a one-time caf and the citys first free software-based wireless
approval process. This approval is not Internet service provider, as well as Yellow Hat, the Tibetan
instantaneous, so if you dont have it, language Linux distribution. Recent Drupal projects include
dont plan for an immediate release architecting a video delivery platform for the worlds largest
of your distro. television network and New York Citys first civic engagement
After youve successfully created and platform for the borough of Manhattan. He is currently CTO
tested your distribution, and uploaded the of a successful startup and president of the Community Free
make manifest, the drupal.org packaging Software Group, an established 501c3 foundation dedicated to
scripts will handle all the rest for you. advancing the cause of software freedom.

Drupal, done beautifully.


We are passionate designers and engineers, dedicated to creating meaningful
user experiences for projects that matter. For more than ten years, weve helped
journalists, educators, human rights activists, climate change adaptation experts,
health care providers, and disaster response teams leverage open source
technology to impact lives.

How can we help with your project? Find out at atendesigngroup.com.

atendesigngroup.com 3507 Ringsby Court, Denver, Colorado, 80216 303-831-0448

LJDrupalSupplement.indd 43 9/17/12 4:15 PM


FEATURE Making Open Atrium Yours

MAKING
OPEN ATRIUM
YOURS
Open Atrium provides organizations and individuals with a free,
robust and flexible project management toolone that
demonstrates just how powerful and beautiful Drupal can be.

PATRICK SETTLE

OPEN ATRIUM is packed full of features right out of the box: a calendar,
discussions, a notebook for project documentation and a flexible task manager. Even
with hundreds of thousands of Open Atrium installs, its most powerful feature is
often never taken advantage of: Open Atrium is an open-source project.
Although people know what open source means, they dont take advantage of
this feature enough, even though it is one of the best features any project could
have. This feature empowers you to do so much more, but it doesnt mean that you
need to be a hard-core developer to participate.
Lets explore some very real examples of the benefits of Open Atriums open-source
feature and look at how you can take advantage of this underutilized facet to make
Open Atrium your own.

44 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 44 9/15/12 9:58 AM


Set Yourself Apart rename anything.)
You probably wouldnt install Drupal Like any Drupal theme, this new
for your business Web site and leave sub-theme Baara will need a .info file
the default theme. Why would you do that will define the name of the theme,
that with Open Atrium? Although Open a description, any CSS style files and
Atriums Ginkgo theme is a very usable regions or DesignKit options. You simply
theme, why not let your design and style can rename crystal.info to baara.info,
shine through to your staff, customers and using your favorite text editor, make
and vendors by customizing the look changes as needed.
and feel of Open Atrium with your own When finished, your .info file should
sub-theme? look like this:
One powerful aspect of Drupals theme
system is its ability to use sub-themes. name = "Baara"

Sub-themes allow you to use an existing description = "A Ginkgo sub-theme to get work done,

theme as a jumping point, saving a based on Crystal for Open Atrium."

significant amount of time, while still core = "6.x"

letting you apply your own design. atrium = "1.x"

engine = "phptemplate"

Crystala Sub-theme for base theme = "ginkgo"

Open Atrium
A good example of a sub-theme for stylesheets[screen][] = "style.css"

Open Atrium is the Crystal sub-theme


by Daniel OPrey. Building off a previous regions[left] = "Left sidebar"

sub-theme, Daniel created Crystal to be a regions[right] = "Right sidebar"

clean app-like theme. Although it could regions[content] = "Content"

be used on its own, lets use it here as a regions[header] = "Header"

starting point for a new theme. regions[space_tools] = "Space tools"

regions[page_tools] = "Page tools"

Installing a Sub-theme regions[palette] = "Palette"

Start by making a copy and renaming


Crystals theme folder into /sites/all/ features[] = ""

themes. For this example, name the


sub-theme Baara, so its folder will be ; Designkit

/sites/all/themes/baara. (If you want designkit[color][background][title] = "Background"

to use Crystal as is, theres no need to designkit[color][background][description] = "Color for

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 45

LJDrupalSupplement.indd 45 9/15/12 9:58 AM


FEATURE Making Open Atrium Yours

headers, other fills." customization that could be managed


designkit[color][background][default] = "#44aa55" through the Drupal admin pages, the
designkit[image][logo][title] = "Logo" designkit entries allow you to specify
designkit[image][logo][description] = "Header logo." the customizations you want to make
designkit[image][logo][imagecache] = "imagecache_scale:300x40" available on /admin/build/themes/
settings/baara. To learn more about
The first six lines set the name and DesignKit and how to use it, see the
description of the new sub-theme, the README.txt, which comes with the
version requirements for Drupal, and DesignKit module (http://drupal.org/
most important, it lets Open Atrium project/designkit).
know that its a compatible theme For additional information on Drupal
and defines the parent theme for the theming and details on available
sub-theme (in this case, Ginkgo). options to use in the baara.info file,
Sub-themes function just like normal read the on-line Drupal Theming Guide
Drupal themes. They can include (http://drupal.org/documentation/theme).
images, stylesheets and templates.
Stylesheets can be reused from the Ginkgo Sprite Overrides
parent theme, or in this example With the new sub-theme folder created
case, be overridden by declaring them and .info file completed, you can turn
in the .info file, as seen on the line your attention to applying style and
stylesheets[screen][] = design. Ginkgos extensive use of sprites
"style.css" , which will override throughout its design allows you to make
the style.css file found in Ginkgo. some pretty radical changes simply by
The regions entries list all regions modifying or replacing these images.
available in your sub-theme. If you Ginkgo uses these sprites as
modify any of the template files to add background images to many of the
new regions, youll need to be sure to elements throughout the site as defined
modify this list. Its important to note in the style.css stylesheet. There are three
that while adding regions can be done main sprite images (along with RTL for
easily, removing or renaming regions right-to-left languages), which you will
should be done with care and may find in the Ginkgo images directory:
cause complications, as many Open
Atrium Features are built to expect n sprite_base.png base UI elements,
those default regions. such as priority indicators and default
If you plan on having additional user avatar placeholder images.

46 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 46 9/15/12 9:58 AM


n sprite_icons.png Atrium Features it difficult to take advantage of
icons used in menus. community-contributed features.
If you dont have the time to create
n sprite_skin.png gradients and your own sub-theme, check out
other backgrounds, along with the http://community.openatrium.com/
default logo. shopresources/feature-directory for
a listing of sub-themes created by other
To override these images in your Open Atrium community members.
sub-theme, re-declare them in your
style.css and include the modified sprite When Something Is Not
images in your Baara themes images Quite Right
folder. If you want to replace the default Now that Open Atrium is looking more
icons, you can modify the sprite_icons.png like your organization, lets consider the
by inserting the custom icons. More- actual features of Open Atrium. Like a
advanced sub-themes may take great many things in life, one size does
advantage of additional sprites, which not always fit all, and each organization
you can include in your sub-themes that uses Open Atrium often has unique
image folder. needs and requirements that require
Be sure to maintain the same metrics changes to the default settings included
and coordinates of these sprite files from in Open Atrium.
the originals; third-party Open Atrium
features are built with this expectation. Overriding Settings
There are three ways to override the
A Style of Your Own settings in Open Atrium: simply make
In the example .info file, you made the the changes in the Drupal configuration
declaration stylesheets[screen] interface, fork the Atrium feature you
[] = "style.css" , which want to modify, or create the much more
overrides the Ginkgo themes style.css flexible custom feature override module.
stylesheet. This not only allows you to The first optionmaking changes
override Ginkgos sprite images, but directly through the configuration
also will house any other CSS style pagesis immediate. It can be done
changes you need. by almost anyone with access, and it
Be careful when overriding any requires no programming. Although this
of Ginkgos design, as changes to sounds great, note that this technique
templates and layouts may make comes with a great deal of riskits

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 47

LJDrupalSupplement.indd 47 9/15/12 9:58 AM


FEATURE Making Open Atrium Yours

Table 1. Some Common Drupal Customizations


COMPONENT CUSTOMIZATION SOLUTION

Blocks or boxes Show or hide Modify the context that sets the block as visible or
hidden (see the section on contexts).

Boxes Modify output Use hook_boxes_view_alter(&$box, $delta).

Contexts Modify settings Use hook_context_default_contexts_alter($contexts)


in a custom module.

User Modify settings Use


permissions hook_user_default_permissions_alter(&$permissions).

Imagecache Modify a preset Use hook_imagecache_default_presets(&$default_presets)


presets in a custom module.

Menu items Modify menu attributes like Use hook_menu_alter() in a custom module.
path or remove an item

Site settings Modify default setting Use hook_strongarm_alter(&$items) in a custom


module.

User roles Modify settings Use hook_user_default_roles_alter(&$roles) in a


custom module.

User roles Modify settings Use hook_user_default_roles_alter(&$roles) in a


custom module.

CCK fields Add a new field to an Add the new field, and then create a new feature
existing content type module that includes this field. The exported field
will contain information that associates it with the
content type.

Views Modify general settings Modify with hook_views_pre_build() in a custom


module.

immediate, ready or not. Once you make production server. Someone has to write
that change, its live. There is no chance down every configuration change that
to coordinate other related changes. In was made, and then on production,
addition, all users with access can make walk back through each change. Second,
a change, even if they didnt mean to theres no way to know what state the
make the change. It doesnt require site is in, so did those changes get made?
programming, which means its not in Theres only one way to checkload each
code. This could lead to a couple major configuration page and look.
issues. First, its difficult to deploy to a Its also important to note that if

48 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 48 9/15/12 9:58 AM


you change a setting through the n Use features on other sites, saving
configuration interface that belongs countless hours of filling out forms
to a feature module, you may have and clicking.
trouble with future upgrades. When
upgrading, you sometimes are required n Features can be shared on feature
to revert the Feature module. This servers, so you can share your work
allows the Feature module to make with the world (or a smaller team).
any new changes to its configuration
to support the upgrade. When this Creating a custom override module
happens, any setting changes that does require a basic understanding of
you made through the configuration the building blocks of Drupal and Open
interface will be lost. Atrium, and it requires that you are
comfortable with code.
Custom Override Module
By far, the best way to manage setting
overrides in Open Atrium is by making
use of a custom override module. This is
a simple module that houses a collection
of Drupal module hooks and alters that
capture the settings into code. This
protects your changes from being lost
during upgrades and provides these
additional benefits: C

Y
Our masks are off -
n Version control: make rollbacks more CM
revealing beautiful sites
granular instead of rolling back the MY inside and out.
entire database. CY

CMY
Easy on the eyes,
easy to use.
K

n Features can be turned on and off per


group. Un-featured configurations are
global in scope.

n Easily see what has changed from one


version of a feature to another using
diff tools.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 49

LJDrupalSupplement.indd 49 9/15/12 9:58 AM


FEATURE Making Open Atrium Yours

Somethings Missing the freedom to participate, and right now is


You may find that special tools are a great time to start. Planning is underway
required for your organization, and to plot the path and direction Open Atrium
although Open Atrium contains a will take as its upgraded to 2.x.
powerful feature set, theres a chance
that youll need something different. Open Atrium 2.0 Roadmap
In some cases, you may find that the Weve identified few key areas that we feel
Open Atrium community already has should be the focus for Open Atrium 2.0:
created the tool youre looking for. For
example, a popular tool that often is n User interface.
added to an Open Atrium install is Atrium
Folders created by Nuvole. Atrium Folders n Improved feature set.
provides a simple file repository feature. To
install this feature, or any other feature or n Third-party integration.
module created by the community, simply
download, extract, copy to your /sites/all/ Open Atriums current Ginkgo theme is
modules/contrib folder and enable. a vibrant breath of fresh air in the arena of
If your needs are even more unique, Drupal themes. However, there is room for
you can create your own feature or improvement with its user experience. We
module as a solution. Being built on top are looking to bring a new dynamic theme
of Drupal, Open Atrium includes a wide to Open Atrium 2.x that takes advantage
selection of building blocks contributed of best practices and technology to provide
by the community, and it often provides a world-class user experience, one that
an excellent starting point for creating a fully supports todays mobile devices.
completely custom feature for your site.
Improved Feature Set
The Next Step Open Atrium 2.0 also will be improving
So, youve installed Open Atrium, created a existing features and adding new features
theme, customized Atrium features, added that support the project management
additional features or maybe even built workflow. We plan to extend features,
your own. Where do you go from here? such as the Calendar/Task/To-Do feature
The next step is to get involved directly and Notebook, while also improving their
with the Open Atrium project. functionality. In addition, we plan to add
Open source not only means you have the useful features like Files and Timekeeping.
freedom to customize and extend, but also Additionally, Open Atriums focus

50 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 50 9/15/12 9:58 AM


on project management calls for a coding contributions, testing efforts,
shift from a generic groups concept documentation assistance and feedback.
to specialized projects. This, coupled We are very excited about this next phase
with a new ability to assign users to of Open Atrium and are excited to work
organizations and set privileges around with the community to make it happen!
these organizations, could provide users
with an intuitive way of managing their Patrick Settle, Drupal developer, digs into his bag of tricks
projects and team members. whenever he runs across a new challenge facing Open Atrium,
which hes been developing since its beginnings. Thanks to
Third-Party Integration 12 years in system administration for companies from SAIC
We know a lot of great tools exist that to the WorldWatch Institute and eight years building Drupal,
people rely on to get their jobs done. We hes uniquely able to balance a versatility in infrastructure
should work toward building Open Atrium planning with a specialized knowledge of application
2.0 with that in mind. Some areas we development that benefits end users and administrators alike.
should look into are calendar, timekeeping
and ticketing integration. Of course, a lot
of solutions exist, so were really going to
need the community to identify and help YOU NEED A
build connections to those services. MARKETING AGENCY
THAT KNOWS THE
Implementation and Community
Participation DIFFERENCE BETWEEN
The community is an essential part of any THE GPL AND A
open-source project, and Open Atrium
GLOBAL PRODUCT
is no exception. Many of these ideas for
improvement have come directly from LAUNCH.
requests through e-mail, Twitter and
https://community.openatrium.com. We get where youre coming from.
There are a lot of great open-source dev shops out
Participation doesnt mean only coding; there. But you need one that can speak open-
we want to hear your thoughts and ideas source and marketing. If you want a Drupal shop
that integrates marketing automation, contextual
on this plan. However, like all open- content and KPIs into a digital strategy designed
source projects, we need developers for Fortune 500 companies, give us a call.

and designers to help start building the


elevatedthird.com
next generation of Open Atrium. This (877) 741-5459
release will not be possible without your

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 51

LJDrupalSupplement.indd 51 9/15/12 9:58 AM


FEATURE Achieving Continuous Integration with Drupal

Achieving
CONTINUOUS
INTEGRATION
with Drupal
Drupal developers want to follow best practices in software
development, testing and deployment, known as Continuous
Integration. However, they often do not have the time, resources
or management support to invest in the necessary infrastructure.
BARRY JASPAN

I
n the early 1990s, my first job out of call the Waterfall method. We thought
college was as a software engineer at we were invincible.
a startup company. We were building We had no idea what was coming.
a commercial product using a well-known After consultation with potential
open-source network security project. In customers, we wrote a Requirements
those days, Agile software development document describing what the product
practices (not to mention the World needed to do, a Functional Specification
Wide Web, or even widespread public that described how the product would
awareness of the Internet) still were in look and behave, a Design document
the future. My fellow engineers on that that described the technical architecture
project (who had just graduated with me and internals of how we would build
and to this day are the best programmers it, and even a Test Plan that described
I know) and I were taught what we now the automated tests we would build

52 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 52 9/15/12 9:58 AM


to ensure the product worked. We Continuous Integration (CI).
had a release deadline, declared by Fast-forward 20 years. Im now at
management, of before Christmas. Acquia, which produces commercial
Good thing we were so young! We products for companies using the
engaged in our Death March. The local open-source project Drupal. Drupal is
Chinese delivery place got to know a LAMP-stack application for building
us well. I got home around 1am every Web sites and services. We realized
morning for months. We finally finished early on that everyone using Drupal
and shipped version 1.0 of the product needs to host it somewhere, and that
on December 18. It took me a few weeks most people building sites with Drupal
to remember what normal humans did do not also want to have to become
when they were not at work. experts in building a reliable, scalable
infrastructure for hosting it. More than
What Did I Learn from This that, they also want to be able to follow
Experience? best practices in software development,
What we did wrong: basically, everything testing and deployment; they want to use
about the software engineering Continuous Integration. However, they
methodology we used was completely often do not have the time, resources
stupid. We shipped a working product or management support to invest in the
on time, but we started with the benefit necessary infrastructure. Ive spent the
of a working open-source project. We last three years addressing that problem.
made essentially every mistake that Agile
development was invented to prevent. What Is Continuous Integration?
What we did right: we actually Many excellent and persuasive
implemented our Test Plan. Since the tests resources on the Web talk about the
were automated, the build process had principles of CI in detail. In this article,
to be automated. It certainly added a lot I discuss a simplified list of the most
of extra work to the project, but the meaningful best practices for Drupal
payoff was huge. Before we left for the Web site development:
day, we would kick off the build script.
When we came in the next morning, if the 1. Use a source code repository. This
last line of output said PASSED, we felt is step zero for good software
confident and ready to ship. We didnt development. Most people are doing
know it at the time, but we were on the this, using Git, SVN or other systems;
path of what eventually would be called if you are not, start now.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 53

LJDrupalSupplement.indd 53 9/15/12 9:58 AM


FEATURE Achieving Continuous Integration with Drupal

2. Make small, frequent changes. All 6. Have an audit trail (that is, a blame
developers should commit their list). This helps you not just in the
changes frequently. This reduces the source control of who made this
inevitable conflicts and lets problems commit, but who deployed the
surface sooner. Also, small, frequent commit as well. This can provide
changes enable small, frequent rationale as well as potential fixes.
releases, making all the rest of the
principles more valuable. 7. Automate site deployment. In order
to tolerate small, frequent releases,
3. Automate testing. Have your pushing a release needs to be an
repository automatically integrated automated process so its very quick
with a testing environment, so that and easy. If its a big chore to push one
every commit triggers a test run. release, the whole process falls apart.
This way, you know immediately if
something broke. 8. Measure results and iterate rapidly.
Are the changes helping? Is the site
4. Test in a clone of the production faster? Did the usability enhancement
environment. It does no good to yield more sales? If its not, you can
test your software under different iterate again.
conditions from those that it will
run in production; doing so is a Achieving Continuous Integration
recipe for taking down your site requires some amount of infrastructure,
when you deploy. Never hear the culture and discipline of the
someone say But it worked on engineering team to use it, and
my machine! again. managements understanding and
commitment so that it supports the
5. Make all versions easily accessible. necessary investment. This is an article
Despite best efforts, production about technology, not management
releases still will break, so you and culture, so I focus primarily on the
need an easy way to re-deploy a infrastructure here.
prior version. Then, youll want to
compare the working and broken Building It Yourself
versions to figure out what went Many shops build their own CI systems
wrong. To do this, youll need a that are perfectly tailored to their own
reference copy of past releases. needs. Doing so is perfectly reasonable

54 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 54 9/15/12 9:58 AM


if you have the time and resources to available running copy of everyones
get there. The biggest danger of doing it latest code. One way to do this is to
yourself, of course, is deciding toand deploy the tip of your main development
then not getting around to it. You end up branch automatically to a shared
doing things the manual, slow and error- development environment, so everyone
prone way until we have time to fix it, always can see it. You can script this
which often turns out to be never. yourself using your repos post-commit
When you do get started, it probably will hooks. A build automation tool like
end up being a permanent side project, Jenkins will help, but you still need to
which may lead you to cut corners that write the deployment script yourself.
will end up causing problems at the Automate testing. Assuming you
worst possible time later. write automated tests for your site,

IF YOU FOOL YOURSELF THAT YOU CAN MOCK


OUT THESE DEPENDENCIES AND HAVE PURELY
STANDALONE UNIT TESTS THAT CAN RUN
ANYWHERE, REALITY WILL MOCK YOU BACK.

Here are some of the things you should you will want to run them every time
keep in mind. someone makes what they believe is
Use a source code repository. You a release-ready commit. Lots of tools
probably already are (right?). You will exist for doing this. One popular choice
need to be familiar with its post-commit is Jenkins (formerly called Hudson), and
hook capability to script actions based it is excellent. It can integrate directly
on it. If you are using a hosted repository with your code repository and trigger a
(such as GitHub), you will have to job on every commit, or run a job on
integrate with its Web-based hooks. a schedule.
Make small, frequent changes. All of The tests themselves are not the whole
your developers will be making frequent story though. Because your application
commits, resolving conflicts locally as is a Drupal site, you need to test it in a
best they can. To keep things moving Web environment. Youll certainly need
forward, you need to have a constantly a running database server. If you want

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 55

LJDrupalSupplement.indd 55 9/15/12 9:58 AM


FEATURE Achieving Continuous Integration with Drupal

to test actual page loads like a browser your test environment as it is your
would see, youll need a running Web production environment.
server too. You probably want to test Where do you run all this stuff?
your application along with a reasonably The simple answer is to run it on
current production database; if you the same server as Jenkins. However,
dont automate that, one day youll Jenkins probably is not running on your
find yourself testing against year-old production servers, so immediately
data. However, you also probably want your test environment is different from
to scrub your current production production. Do you know that when you
database before running tests against install Jenkins via your distros package
it, lest you accidentally spam all your manager that it does not pull in some
customers from your test servers, or other package that your site might end
worse. This is all the responsibility of up using in testing but then fail because
your test harness script, run by Jenkins. it is missing in production?
If you fool yourself that you can This points to an even deeper issue.
mock out these dependencies and You cannot create a clone of your
have purely standalone unit tests that production environment unless you
can run anywhere, reality will mock know exactly what your production
you back. You will discover that tests environment really is. What packages
are not accurately simulating your live are installed? What configuration
environment, and you will have to roll files are in place? What dmons are
back a release that passed all of its running? What security updates have
tests but failed in production. been installed? Running a production
Test in a clone of the production Web site leads to all kinds of unexpected
environment. This is where things really issues and surprises, and even the best-
get interesting. Ive already talked about intentioned, well-meaning sysadmins are
needing a running Web and database likely to solve a crisis by changing some
server. If your site uses additional services configuration on the server by hand. You
like memcached, Varnish or Apache Solr, have to make sure those changes always
you need to make sure those are in place get propagated to your test environment.
too. If your production site uses SSL, you For that matter, you have to make sure
either need SSL running in your testing they are permanently maintained in your
environment, or you need to turn off the production environment too.
checks or redirection that enforces it. This leads directly to the topic of
Ultimately, it is as much work to maintain DevOps and server configuration

56 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 56 9/15/12 9:58 AM


management. The only way to be make to reduce the effort. However, if
sure your production environment is you make the mistake of thinking of your
the way you expect is to automate its server configuration as something you can
configuration, and the only way to ensure just build once and forget about, your Web
that your test environment is a clone of site is eventually going to suffer for it.
your production environment is to use Make all versions easily accessible.
exactly the same automated configuration When its time to push to production,
to build it. There are good open-source you want to create a symbolic tag in your
tools for doing this; Puppet and Chef version control system that says what you
are the two I am familiar with. However, released when. If you release frequently,
Puppet and Chef are programming youll end up with a lot of tags, but thats
languages in their own right. Once you go okay; theyre cheap. You probably will
down this path, you are now maintaining end up creating these tags in the script
two completely different pieces of you create to automate deployment.
software: your Web application and the Maintain an audit trail. Your VCS gives
infrastructure automation to run it. At you a commit history for your source
this point, you need to make a recursive code, but you need more than that. When
call to start reading this article over at something goes wrong, you easily should
the beginning, because you will need be able to point to the date/time/individual
to use Continuous Integration on your that played a part and quickly get the
infrastructure automation just like you information you need. Who pushed the
do for your Web app. So, your Web app release to production earlier today? Who
needs a production and test environment, added a new domain name to Apache
all of which is running in your production virtual host configuration? Can you
infrastructure environment; now you need verify that the SSH key for the employee
a test infrastructure environment in which that left last week has been removed?
to test updates to your infrastructure code Most changes will be in your Web site
before rolling them out to production. source code, but some will be in your
If you are using Jenkins to run your CI infrastructure configuration code, so you
process, and Jenkins is deployed as part will want a unified view of the changes.
of the infrastructure you are developing, Automate site deployment. Okay, so
then...your brain just hit a stack overflow you are working in small batches with
and exploded. Ooops. frequent commits, testing every time in
To be clear, this is all doable, and there a clone of the production environment.
may be simplifying assumptions you can Now it needs to be easy to push your

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 57

LJDrupalSupplement.indd 57 9/15/12 9:58 AM


FEATURE Achieving Continuous Integration with Drupal

new application to the live environment. have lunch five minutes later without
If youve automated your infrastructure worrying about it.
as described and already have a system Measure results and iterate rapidly.
in place for deploying new code commits There are many great monitoring and
to your testing environment, this should measurement tools available that check
be a pretty small additional step. It has for things, such as error logs, page
to be simple, fast and reliable; you want load performance, server performance,
to be able to push a release and go A/B testing and more. Because

Figure 1. The Workflow page is the centerpiece of Acquia Clouds CI system.

58 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 58 9/15/12 9:58 AM


youve automated your infrastructure automated CI infrastructure as described
configuration, integrating these onto above? I thought so. The fact is that
your servers is not that much additional infrastructure is not your specialty.
work, but you still have to decide which (If it is, can we hire you?) You build
ones to use, how best to install them, exceptional Web sites, and you should
and how to get the data you need out of not spend so much time and effort also
them most efficiently. building the servers to run it.
Your alternative is to use a system
Use an Existing System someone else built for you. Several exist,
Whew! Okay, be honest. How likely each with different properties, and with
is your company actually to make the more arriving all the time. I happen to be
investment to build and deploy an the lead engineer for Acquia Cloud, so

Figure 2. The Code selector lets you deploy any branch or prior release version to
any environment.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 59

LJDrupalSupplement.indd 59 9/15/12 9:58 AM


FEATURE Achieving Continuous Integration with Drupal

ACQUIA CLOUD PROVIDES A DEVELOPMENT,


STAGING AND PRODUCTION ENVIRONMENT
FOR YOUR SITE.

let me quickly demonstrate how Acquia for initial integration testing. Set it to
Cloud provides everything you need to deploy the master (Git) or trunk
implement CI for your Web site. (SVN) branch, and every developers
Use a source code repository. Acquia commits are available immediately for
Cloud provides both Git and SVN initial experimentation.
repositories. The URL is displayed right Automate testing. Every time you
at the top. deploy code or perform various other
Make small, frequent changes. actions, Acquia Cloud runs Cloud
Acquia Cloud provides a development, Hooks. These are simple scripts that
staging and production environment for you put into your code repository to
your site. You can deploy any branch perform any actions you want. Each
or tag from your repository in any of hook is tied to specific actions in a
them. When you deploy a branch in specific environmentfor example, all
an environment, every commit to that scripts in the hooks/post-code-deploy/
branch is deployed to that environment. prod directory of your repository
This makes the Dev environment perfect run when you deploy code to the

Figure 3. The Task log shows all changes to any of your sites environments.

60 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 60 9/15/12 9:58 AM


Figure 4. Details are available for every task.

Production environment. The hook of these environmentsDev, Stage and


scripts run in sorted order until the first Prodfor you. You can choose whether
one fails, and the output from all hook they are on the same or different
scripts is available at the end. This is servers, and whether they are redundant
the perfect way to run your test scripts, and load balanced or running on a
scrub a database, perform a load test or single VM, but we ensure that as far as
anything else. your Web application is concerned, the
Test in a clone of the production configuration is identical. Of course, we
environment. This is the biggest payoff also provide 24/7 monitoring, backups,
with Acquia Cloud. We maintain each security updates and critical fixesall

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 61

LJDrupalSupplement.indd 61 9/15/12 9:58 AM


FEATURE Achieving Continuous Integration with Drupal

Figure 5. Deploying code is a simple drag-and-drop operation (API and CLI also
available).

the things you would have to do on your an environment deploying a branch, it


servers yourself. creates a symbolic tag at the tip of that
Make all versions easily accessible. As branch and deploys the tag in the target
you can see in Figure 2, you can always environment. If you drag an environment
revert back to any specific tagged version deploying a tag, it just deploys the
or branch in any environment. same tag in the same environment. You
Have an audit trail (that is, a blame list). always can deploy any branch or any
Our task log is your audit trail. It shows previous tag in any environment just
code commits, but also all changes to by selecting it from the drop-down list
your Web environment: domain names, (or, again, via our API or CLI).
SSH keys, server launches and so on. It Measure results and iterate rapidly.
shows you exactly what date and time This article mostly been has about
each action took place, with the option to Acquia Cloud, but Acquia Cloud is itself
show the full detail for the command. just a feature of the Acquia Network
Automate site deployment. To deploy that provides a wide variety of tools to
a release from one environment to improve your site, such as expert Drupal
another, simply drag and drop on the configuration advice, SEO optimization,
UI (or use our API or Drush CLI to do faceted search, performance monitoring,
the same thing). If you drag code from load testing and spam blocking, plus

62 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 62 9/15/12 9:58 AM


Figure 6. The Acquia Network provides resources to understand and improve your
sites results.

services like education, training and


Barry Jaspan is a serial software engineer and entrepreneur
support. The Acquia Network is part of
who has been creating and selling open-source software
every Cloud subscription and includes all
of these tools, most for free. products literally since he was 12 years old (many moons

To view a video overview that showcases ago!). Currently Senior Architect at Acquia, he leads Acquia
how to develop with Acquia Cloud for your Cloud, the Drupal-optimized PHP cloud hosting platform that
Drupal site, I have a Webinar on this very runs tens of thousands of Drupal Web sites on thousands of
topic available at http://ow.ly/cUNlL. cloud-based servers for some of the best-known brands in
To sign up for a completely free the world. He is an angel investor and advisor to Boston-area
version of Acquia Cloud, visit startups and, when he pulls himself away from the keyboard,
http://network.acquia.com/freecloud. an avid whitewater kayaker and rock climber.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 63

LJDrupalSupplement.indd 63 9/15/12 9:58 AM


FEATURE RedHen CRM

RedHen CRM
an Open-Source
CRM Solution Built
Entirely with Drupal
Historically difficult to implement in Drupal, native CRM
solutions in Drupal 7 now allow site builders to craft more
personalized user experiences for their Web site visitors by
integrating their Drupal CMS with their customer relationship
management system (CRM). SEAN LARKIN and LEV TSYPIN

64 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 64 9/15/12 9:58 AM


O
ne of Drupals key value The State of Third-Party CRM
propositions is its ability to Integration in Drupal
integrate conventional content Drupal has long been ahead of the CRM
management features with other Web- integration curve because of its open-
based applications and tools. More source flexibility. Integration between
and more, Drupal is becoming a Web Drupal and the open-source CRM
application platform for building engaging CiviCRM (http://civicrm.org) historically
Web sites that provide rich, personalized has seen the widest adoption. Like
content experiences for site visitors. Drupal, CiviCRM runs on a LAMP stack
We often recommend that our clients (Linux, Apache, MySQL and PHP) and can
begin crafting more personalized user be configured to run as a component of
experiences for their Web site visitors a Drupal Web site. CiviCRM is a mature
by integrating their Drupal CMS with solution with a number of great features
their customer relationship management mostly geared toward the constituent
system (CRM). relationship management needs of
The benefits of such integrations are nonprofit organizations.
many. You can present forms for your While CiviCRMs integration with
site visitors to update their own CRM Drupal is robust, its still not perfectly
contact records or to provide you with seamless due to the fact that CiviCRM
better data about their interests and was engineered to work with multiple
communication preferences. Based upon CMS front ends. CiviCRM relies on its
such information, you can serve up own database schema and APIs. It also
more pertinent content, as well as offer leverages its own templating engine
premium access to special features. that presents different markup from
In fact, the value of CRM/CMS integration that generated by Drupal. For Drupal
is becoming so compelling that most developers looking to build tightly
large CRM companies, such as Salesforce, integrated CMS/CRM solutions, CiviCRM
Microsoft Dynamics, Oracle and Blackbaud, integration requires mastering more APIs
are enhancing their Web-based products and maintaining more code. For site
and adjusting their marketing language builders and Web site administrators,
to describe their offerings as social CiviCRM integration requires
enterprise or customer engagement additional training, because CiviCRMs
platforms. The pundits often use the administrative interfaces follow different
buzzwords Social CRM to describe these design patterns from those provided
retooled and rebranded CRM solutions. by Drupal. Further, given that major

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 65

LJDrupalSupplement.indd 65 9/15/12 9:58 AM


FEATURE RedHen CRM

releases of CiviCRM rely upon specific n Potential reductions in technical risk


versions of Drupal core, upgrading since all your tools rely on a single
Drupal-CiviCRM solutions can present Drupal instance.
significant hurdles.
n Potential reductions in hosting and
CRM Options Built Natively IT costs.
within Drupal
The Drupal community has long aspired n The ability to do complex engagement
for native CRM functionality. The most scoring or engagement analytics (more
obvious benefits of native CRM in on this later).
Drupal include:
n And probably most important, the
n A more seamless user experience ability to customize fully your CRM
for site visitors registering for solution the Drupal way.
events, making donations/payments
or engaging in other Web site The arrival of the entity framework in
transactions. Drupal 7 core has opened the door to
the development of more robust CRM
n The opportunity to leverage Drupals solutions built natively in Drupal. So,
growing suite of mobile and after a year of scheming and more than
responsive tools and themes for 1,000 hours of intense development,
CRM interfaces. ThinkShout, Inc., recently announced the
beta release of RedHen CRMa native
n The ability to expose CRM data as CRM solution written for Drupal
content and display aggregate CRM in Drupal. And, we anticipate that
data on your site. RedHen will have a stable release by
the time this article is published.
n Increased opportunities to integrate
CRM data with Drupal contributed RedHen CRM as a CRM
modules, such as data visualization Framework
and geo-mapping. ThinkShout initially designed RedHen
CRM around the complex association
n Reduced staff training costs by management (AMS) needs of nonprofits
eliminating the need for staff training and trade associations. Based upon
on multiple platforms. a site visitors affiliation with an

66 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 66 9/15/12 9:58 AM


organization that has purchased one or for different use cases. At the time of
more membership subscriptions, that this writing, we know of more than 96
site visitor is provided premium access RedHen CRM solutions built by other
to content, e-commerce discounts Drupal developers and site builders, and
and advanced Web site features when we anticipate this number will increase
logged in to a Web site built on top of by the time this article is published.
RedHen CRM. In addition to its association
These association management management uses, we see RedHen CRM
requirements go well beyond the as an ideal starting point for building
standard needs of most CRM/CMS custom sales pipeline management
solutions. However, in building an tools and project management
abstract tool with these needs at applications, as well as Drupal
the forefront, our goal has been to integration points with third-party ERP
future-proof RedHen CRM as much as (enterprise resource planning) tools and
possible to ensure that its architecture financial accounting packages.
can accommodate a wide variety of
use cases. RedHen CRM Project Structure
RedHen CRM is similar to Drupal RedHen CRM consists of a core module
Commerce (http://drupal.org/project/ containing shared APIs and interfaces
commerce) in its modular structure. As and a collection of feature-specific
with Drupal Commerce, the core RedHen sub-modules, including:
modules that can be downloaded on the
drupal.org project page wont provide n Contact (redhen_contact): contact
you with a working CRM right out of entities and APIs, along with
the box. RedHen is intended to provide integration with Drupal users.
developers and site builders with the
building blocks for quickly creating their n Fields (redhen_fields): custom field
own CRM data models that map to types used by RedHen entities.
their particular business requirements Currently this includes a unique
and workflow. Consequently, setting e-mail field, which assigns attributes
up a new RedHen CRM instance does to e-mails, such primary, bulk and
require configuration. custom labels (home, work and so on).
In the future, ThinkShout is likely to
release RedHen Features or Apps n Organization (redhen_org):
that provide prepackaged CRM solutions organization entities and APIs.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 67

LJDrupalSupplement.indd 67 9/15/12 9:58 AM


FEATURE RedHen CRM

n Organization Group (redhen_group): key sub-modules will continue to be


lightweight group feature that included with the main module code
turns organizations into containers base. However, we anticipate that as
for private content with a the RedHen CRM developer community
broadcast system. grows, we will see more and more
contributed modules that extend
n Relations (redhen_relation): the RedHens core feature set.
Relation module allows connections The overall architecture of RedHen
between contacts and organizations. CRM consists of a set of minimalistic
building blocks that developers and site
n Note (redhen_note): notes on contacts builders can use to develop solutions
and organizations. tailored to specific use cases. Like
Drupal Commerce, RedHen relies on
n Engagement (redhen_engagement): Drupal distributions and installation
engagement scoring system and APIs. profiles for the heavy lifting of fleshing
RedHen Note integration is included, out polished applications that serve
as well as Rules integration for specific needs.
popular modules, such as Comment,
Registration and Webform. RedHen CRM Module
Dependencies
n Registration (redhen_registration): RedHen has minimal dependencies on
integration with the Entity other Drupal contributed modules,
Registration module. striving for a balance between relying
on its own code base and leveraging
We maintain other functionality other contributed modules. Beyond
that is not needed for all uses cases Drupal core, RedHen CRM currently
in separate projects in order to keep depends only on Entity API, discussed
the core RedHen code base as lean in detail below and the Relation module
as possible. The RedHen Membership (http://drupal.org/project/relation)
system (http://drupal.org/project/ for managing connections. RedHen
redhen_membership) is our most CRM supports integration with popular
widely used RedHen component with contributed tools, like Views and Rules,
its own project name space. It handles but these modules are not required.
individual and organizational membership This makes RedHen a leaner and more
subscriptions. As with Drupal Commerce, stable application platform, as it relies

68 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 68 9/15/12 9:58 AM


less on a shifting foundation of other during CRUD operations providing
contributed modules over which we a consistent interface for other
have little to no control. modules to interface with your
This centrist approach helps assure custom entities.
other Drupal developers that their
customizations and extensions of n Provides hooks and data structures
RedHen wont break due to fragile allowing for entities to be exported,
module interdependencies. At the for example, using Features or
same time, it provides less-technical CTools. RedHen leverages this
site builders with a known approach to feature to make entity bundle
extending RedHen CRM with standard definitions, such as types of contacts
Drupal tools, such as Views, Rules and and organizations, exportable.
the Fields API.

Custom Entities NOTE: At the time of this writing, Entity


RedHen CRM relies on custom Drupal API has 138,685 reported installs all on
Drupal 7 and is among the top 20 modules
entity types and bundles. It leans heavily
on drupal.org. As Drupal dependencies
on Entity API (http://drupal.org/project/ go, it is highly stable and reliable.
entity), a wrapper around Drupals core
entity system that eases developing
entities in several ways. The Entity RedHen ships with the following entity
API module: types, each of which comes bundled with
core properties and can be extended with
n Provides classes and controllers additional user-defined fields:
to streamline entity creation and
management. RedHen extends these n Contacts
base classes as needed.
n Organizations
n Eases integration with key
contributed modules, namely Views n Notes
(http://drupal.org/project/views)
and Rules (http://drupal.org/ n Memberships (part of RedHen
project/rules). Membership)

n Exposes standardized API hooks n Engagements

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 69

LJDrupalSupplement.indd 69 9/15/12 9:58 AM


FEATURE RedHen CRM

Figure 1. Listing of a Contacts Connections

Connections status and role properties, but fields


A key feature of any CRM is managing can be added that are applicable to a
connections between organizations given relationship.
and contacts. RedHen features a very For example, imagine that you want
flexible connection system built on top to define a relationship between a
of the Relation module, which allows for contact of the type Staff and an
bidirectional connections between arbitrary organization of the type Company.
types of entities. These relationships Suppose you want to include information
themselves can have additional user- about the position that contact has at
defined fields. RedHen ships with two that organization. This field value has
types of relationships: Affiliations, which meaning only within the context of
are connections between an organization relationship, and therefore, this data is
and a contact, and Personal Connections, stored with the relationship rather than
which are connections between contacts. on the contact record or the organization
These relationships come bundled with record itself.

70 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 70 9/15/12 9:58 AM


Building an Example Installation
Application with RedHen Here are the installation steps:
Now that youve learned about RedHen,
you most likely will want to know the 1. Download the latest version of Drupal
steps involved in building a useful 7, RedHen, RedHen Membership,
application with it. Below is a step-by- Entity API, Relation and Views.
step tutorial for setting up an association
management system (AMS) for the 2. Install Drupal using an installation
National Association of Pet Shelters, profile of your choice.
an fictional nonprofit organization. For
those who want to follow along, the 3. Enable RedHen and its dependencies.
complete demo application is available
for download as an installation profile Structure
called RedHen Demo (http://drupal.org/ When RedHen is enabled by itself, it
project/redhen_demo) on drupal.org. defines types of entities, but it does not

Did you find this


special edition informative?
Are you interested in
receiving information
on future Linux Journal
Special Editions?

SIGN UP NOW to be included at no cost:


http ://www.linu xjou r na l. c o m/ s pe c ia lis s ue

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 71

LJDrupalSupplement.indd 71 9/15/12 9:58 AM


FEATURE RedHen CRM

Figure 2. Managing the Fields Associated with a Contact Record

create instances of these entity types. and machine name. Create one for
That is because, out of the box, RedHen Staff and Volunteers.
doesnt presume to know the types of
contacts, organization, memberships and n Organizations: aside from machine
so on, that will be needed for a given name and label, organization bundles
CRM deployment. In Drupal speak, these can be turned into content groups
entity type instances are called bundles. if the redhen_org_group module is
In the next step, you will define bundles enabled. Checking the groupify
for each of your RedHen entity types. box exposes two additional settings:
First, navigate to /admin/structure/ private and a list of content types
redhen to see the types of entities that that can be posted into the group.
can be managed through RedHen. They Create two organizations, Foundation
are, again, contacts, engagement scores, and Shelter, making the latter a
memberships, notes and organizations. content group.
For each of them, create the following
bundles, respectively: n Notes: notes come with a default
single bundle since there is only one
n Contacts: contacts have only a label type of note.

72 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 72 9/15/12 9:58 AM


Figure 3. Custom Fields Being Exposed as Filters on a Listing of Contacts

n Memberships: memberships have an the e-mail field, which RedHen adds


additional user role property that is automatically behind the scenes to
inherited by linked Drupal users with each contact bundle, because e-mail is
a given membership. Create Premium required for several core components
and Standard memberships. of the system. Incidentally, we
developed our own e-mail field that
n Engagement Scores: engagement mimics v-card structure allowing for
scores have an additional score multiple e-mail addresses per contact
property. Create High-value that have different labels and flags for
engagement and Standard-value default, bulk and on-hold statuses. In
engagement with arbitrary scores. addition, the contact name is visible,
although it doesnt have any settings
Now that your bundles have been to manage. This is because name is a
created, you can add fields to them. property on a contact, which Drupal
Each bundle has a manage fields allows developers to expose as a
link. To manage fields for your staff pseudo field, so that its position
contact type, for example, visit can be managed along with other
/admin/structure/redhen/contact_types/ traditional fields.
manage/staff/fields. Youll notice The interface for managing fields

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 73

LJDrupalSupplement.indd 73 9/15/12 9:58 AM


FEATURE RedHen CRM

Figure 4. Listing of Default RedHen Relation Types

is part of Drupal core and is available by creating a custom View with


when the Field UI module is enabled. the same path and including any
Any field type can be added to your additional fields.
contact bundle, ranging from a simple Relationships are another key
text field to a complex address field, component of RedHen and can
to an image or file upload field. Once connect contacts to organizations
a field is added to a bundle, it will be and other contacts. As mentioned
presented automatically when adding earlier, RedHen installs two types of
or editing an instance of the entity relations: Affiliations for connecting
bundle (that is, an individual contact contacts to organizations and Personal
record), and it will be available to Connections for relating contacts to each
other components, such as Views other. From the Relation types interface,
or Rules. Fields attached to RedHen you can add fields to these default
entities do not get added to the relation typesfor example, a position
default tabular listings, but they field to Affiliationor create additional
are made available automatically relation types, such as Employee.
as filters when changing bundles. When creating a relation, you
You can override the default listings must specify the types of source and

74 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 74 9/15/12 9:58 AM


Figure 5. Custom Contact View with an Address and Exposed Filters

target entities and directionality of the the Entity API interfaces still needs
relation. For the sake of this demo, lets to clarify the data types of all entity
stick with the default relation types. properties and provide Views handlers
for any nonstandard data. For
Playing Well in the Drupal Sandbox example, organization entities have
RedHens default listings of contacts a primary contact associated with
are a good start, but the fun really them, and its up to RedHen to explain
starts if you want to create your own to Views that the related contact
custom views. The venerable Views ID within an organization record is
module, a powerful graphical query actually a RedHen contact. Lets create
builder, is the gold standard in Drupal a new View, adding additional fields
for creating custom lists of stuff, and relationships to the standard list
including RedHen entities. Much of of contacts:
the heavy lifting involved in Views
integration is handled by the Entity 1. Create a new view at /admin/
API, but any module implementing structure/views/add of Contacts.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 75

LJDrupalSupplement.indd 75 9/15/12 9:58 AM


FEATURE RedHen CRM

Figure 6. Custom Rule That Demonstrates Sending an E-mail to New Contacts

2. Add relationships to Memberships and Similarly, business rules can be


Organization affiliation. extended using the Rules module, which
provides an interface for defining logic
3. Add the following fields: contact first and based upon a triggeraction model.
last name, contact e-mail (change the RedHen again leans on the Entity API to
format to primary e-mail), membership expose RedHen entities into this model,
name and organization name. so that you can, for example, send
an e-mail to a contact when a related
You now have a View of all contacts membership entity is updated.
that includes their membership and
organization. If you set the path of the Extending Core Functionality
View to /redhen/contact, it simply will RedHen also can be extended and
override the default contacts listing, or customized the old-fashioned wayby
you can move it elsewhere to maintain writing custom code. All of RedHens
both interfaces. entity types feature APIs with standard

76 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 76 9/15/12 9:58 AM


CRUD operations and wrappers around foreach ($contacts as $contact) {

many common tasks, such as getting $uri = entity_uri('redhen_contact', $contact);

all related entities. In addition, RedHen $actions = array(

can be manipulated using Drupals l(t('edit'), $uri['path'] . '/view/edit',

hook system. Each entity can be altered array('query' => drupal_get_destination())),

using a hook implementation when its l(t('delete'), $uri['path'] . '/view/delete',

loaded, created, updated and deleted. array('query' => drupal_get_destination())),

Most hooks are exposed through );

the Entity APIs inherited controller


classes, but RedHen features some $redhen_contact_type = redhen_contact_type_load($contact->type);

of its own unique hooks as explained $rows[] = array(

in redhen.api.php. For example, a 'data' => array(

module can dictate whether a contact $redhen_contact_type->label,

entity can be deleted by implementing l($contact->first_name, $uri['path']),

hook_redhen_contact_can_delete(): l($contact->last_name, $uri['path']),

l($contact->email, 'mailto:' . $contact->email),

function mymodule_redhen_contact_can_delete(RedhenContact $contact) { format_date($contact->updated, 'short'),

// prevent the deletion of active contacts implode(' | ', $actions)

if ($contact->redhen_state == REDHEN_STATE_ACTIVE) { )

return FALSE; );

} }

$render['table'] = array(

In addition, all of RedHens main '#theme' => 'table',

interfaces are wrapped in theme '#header' => $header,

functions so they can be overridden at '#rows' => $rows

the theme level. For example, to alter );

the default list of contacts, implement $render['pager'] = array(

theme_redhen_contact_list(): '#theme' => 'pager',

);

function mytheme_redhen_contact_list($variables) { }

$contacts = $variables['contacts']; else {

$header = $variables['header']; // no results, set a message

if (!empty($contacts)) { $render['no-result'] = array(

$rows = array(); '#type' => 'markup',

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 77

LJDrupalSupplement.indd 77 9/15/12 9:58 AM


FEATURE RedHen CRM

'#markup' => t('Sorry, there are no contacts much more affordable and nimble than
that match your criteria.'), trying to develop comparable features
); upon larger, more cumbersome
} enterprise packages.

return render($render); Sean Larkin has more than ten years of diverse leadership and
} technical consulting experience. He has been working with the
best and brightest software engineers and designers in the
In short, using RedHens comprehensive Drupal community for the past five years. He has led national
APIs, hooks and theme wrappers, a community organizing initiatives and international relief
developer can build a complex, elegant projects, served as a fundraising strategist for environmental
solution to meet nearly any use case groups worldwide, and ran two open-source software
requiring CRM functionality. consultancies specializing in Drupal development. He holds a
Master of Public Administration (MPA) degree from Syracuse
Conclusion Universitys Maxwell School. Outside work, Sean is an avid
Although we think its possible to build whitewater enthusiast, certified kayaking instructor, raft
very robust, large-scale CRM solutions guide and whitewater videographer. He has been a longtime
natively in Drupal, ThinkShouts goal in advocate and supporter of river conservation organizations,
releasing RedHen CRM is not to compete such as River Network and Waterkeeper Alliance.
with the enterprise CRM market.
Platforms like Salesforce almost inevitably Lev Tsypin has more than 12 years of experience leading
will out-scale any CRM solution that we technology projects and is a technical architect and
can build with Drupal. co-owner of ThinkShout, Inc., where he leads technical
That said, enterprise CRM solutions design, user interface and module development. Prior to
often are overkill for small to mid- ThinkShout, Lev ran the highly respected consultancy, Level
size organizations and businesses. Online Strategy. In the 1990s, he worked as a consultant
Moreover, even if your organization with Computer Sciences Corporation (CSC) and Inforte
does need an enterprise CRM solution, Corporation in Chicago. Before starting Level OS, he served
we see RedHen as a natural integration as the Director of Programming at Pop Art, Inc. He holds
point between your Web site and such a Bachelors degree in Business Administration (BBA) and
a system. RedHen CRM opens the door Political Science from the University of Wisconsin-Madison.
to the creation of highly innovative When not working to help organizations through technology,
front-end CRM tools. We anticipate Lev likes to take advantage of the areas they protect, be it on
that collecting and displaying data foot, skis or bikeat least when hes not wrapped up with
in RedHen (and Drupal) often will be his two boys, which isnt very often these days!

78 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 78 9/15/12 9:58 AM


Resources
ThinkShouts Marketing Site for RedHen CRM: http://redhencrm.com

RedHen CRM Twitter Account: http://twitter.com/redhen_crm

RedHen CRM Source Code, Project Page and Issue Queue: http://drupal.org/project/redhen
(RedHen CRM download and usage statistics can be found here as well.)

The RedHen CRM Demonstration Drupal Installation Profile Download: http://drupal.org/project/redhen_demo

CiviCRM, the Open-Source CRM Solution: http://civicrm.org

Drupal Commerce, the Leading Drupal E-commerce Package with Which RedHen Integrates:
http://drupal.org/project/commerce

ThinkShout, Inc.: http://thinkshout.com

ThinkShout on Twitter: http://twitter.com/thinkshout

Linux JournaL
now available
for the iPad and
iPhone at the
App Store.

linuxjournal.com/ios
For more information about advertising opportunities within Linux Journal iPhone, iPad and
Android apps, contact Rebecca Cassity at +1-713-344-1956 x2 or ads@linuxjournal.com.

LJDrupalSupplement.indd 79 9/15/12 9:58 AM


DRUPAL MARKETPLACE GUIDE

GOLD SPONSOR
New Relic:
A developer's best friend
to monitor end-to-end
performance of your PHP app.
http://www.newrelic.com

New Relic is the all-in-one web application performance


management tool for the cloud and the datacenter. Its SaaS
solution combines real user monitoring, application monitoring, server
monitoring and availability monitoring in a single solution that has changed the
way developers and operations teams manage web application performance in real time. More than 25,000
organizations use New Relic to optimize over 58 billion metrics in production each day. Fully implemented in
just minutes, New Relic provides 24/7 real user monitoring and code level diagnostics for web apps deployed
on dedicated infrastructures, the cloud or hybrid environments. New Relic provides support for PHP, Ruby,
Python, Java, and .NET platforms and related frameworks, including Drupal. New Relic also partners with
leading cloud management, platform and hosting vendors to provide their customers with instant visibility
into the performance of deployed applications. New Relic partners include Acquia, ActiveState, cloudControl,
Joyent, Pantheon, PHP Fog, and Tier 3.
New Relic is the only application performance management tool to offer enterprise-class capabilities
multi-language support, user monitoring, server monitoring, and deep-dive transaction analysisin a single
tool delivered as a service. Unlike traditional APM tools, it is easy to install, implement, and maintain, and
requires no upfront investment. See for yourself why New Relic is indispensable for its customers. Or sign up
today for a free 14-day trial of New Relic Pro.  p. 86, 87, 140, 141

SILVER SPONSOR
Acquia
https://www.acquia.com
Acquia empowers enterprises with the open source
social publishing system Drupal. Co-founded by Drupals creator in 2007, Acquia helps customers manage their
growth and scale their online properties with confidence. Acquias products, cloud infrastructure, and support
enable companies to realize the full power of Drupal while minimizing risk, as its done for more than 2,400
enterprise customers including Twitter, Warner Music Group, Turner Sports, World Economic Forum, Stanford
University, Mercedes-Benz and NPR. See whos using Drupal at http://www.drupalshowcase.com, and for more
information please visit www.acquia.com or call 888-9-ACQUIA.  p. 21

80 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 80 9/15/12 9:58 AM


DRUPAL MARKETPLACE GUIDE

SILVER SPONSOR
Aten Design Group
http://atendesigngroup.com
Aten Design Group is a web strategy, design, and development company based
in Denver, Colorado.
We are Drupal experts and open source contributors. We design, build and support websites for organizations
doing good work all around the world. We're passionate about meaningful user experience, beautiful design, and elegant
open source solutions. Since 2000, weve worked with journalists, educators, human rights activists, health-care providers,
climate change adaptation experts, international aid workersa broad range of organizations committed to making positive
changes in the worldto build interactive platforms that help impact lives.
We provide comprehensive strategy, design and development services to run all aspects of successful interactive
projects, from start to finish. Our services include content strategy, information architecture, technical planning, design,
development, support, dev-ops and server management.  p. 43

BRONZE SPONSORS
Elevated Third http://www.elevatedthird.com
Founded in 2005, Elevated Third is a leading digital agency in Denver, Colorado. Through its unique combination of user-centered
creative and open-source technology, Elevated Third is recognized for its digital marketing solutions that integrate intuitive user
experience design using Drupal. The agency provides a variety of other award-winning services, including branding and usability
and SEO consulting. For more information, visit elevatedthird.com, the company's Facebook page, or follow @elevatedthird.  p. 51

FiberCloud, Inc. https://www.FiberCloud.com


FiberCloud is an IT and Cloud Infrastructure Provider. With a focus on superior service and support FiberCloud delivers colocation,
cloud and connectivity solutions to businesses of all sizes. FiberClouds infrastructure and cloud software solutions enable companies
to securely and efficiently run their IT infrastructure and enable enterprise mobility, communication and collaboration. Our customized
platforms allow developers to focus on their real work without worrying about the infrastructure.  p. 121

ImageX Media http://www.imagexmedia.com


ImageX is an award-winning Drupal website design, development & consulting agency. Founded in 2001 as a full service media firm
we've spent the past seven years refining our approach to building Drupal based sites. With a long history of contribution in the
Drupal community and with over 100 successful Drupal site launches (including clients such as Disney, WB Records, Portland State
University, Oncology Nursing Society, Vancouver School Board, Twit TV and AETN) we have the expertise needed to ensure success.  p. 49

Advertiser Index
ADVERTISER URL  PAGE #

Drupal Association http://association.drupal.org/drupalcon 23


http://DrupalSummit.com
For more information on advertising in
Linux Journal and special editions, please visit Lullabot http://www.lullabot.com5
http://www.linuxjournal.com/advertising.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 81

LJDrupalSupplement.indd 81 9/15/12 9:58 AM


INDEPTH
Speed Up
Your Drupal
Development
Using Installations
and Distributions
Create your own customized distribution to speed up your
Drupal development process.
OLIVER DAVIES

Do you find yourself repeating the same in this article has been committed into
steps whenever you start a new Drupal GitHub at https://github.com/opdavies/
project? Do you always download and linuxjournal_demo, and its available for
enable the same modules, and make the you to download and re-use as needed.
same configuration changes every time?
As we start doing more and more Drupal What Are Installation Profiles?
projects at Nomensa, I noticed that we Installation profiles are a combination
were doing exactly this, so I started to of modules and themes and predefined
look into ways to streamline our initial configuration. A great example of an
project setup process. My solution was to installation profile that I use regularly is called
create my own custom installation profile Commerce Kickstart (http://drupal.org/
that provides me with a template to start project/commerce_kickstart). It provides
each project, and this article outlines the a version of Drupal 7 along with the
steps I took to create it. The code outlined Drupal Commerce suite of modules that

82 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 82 9/15/12 9:58 AM


INDEPTH

Figure 1. The Commerce Kickstart Project Page

have been preconfigured to have the is to download it as a distribution from


correct content types, rules, views and so http://drupal.org. To do this, go to the
on. Once an installation profile has been project page for the installation profile
uploaded onto drupal.org as a project, (for example, http://drupal.org/project/
it gets bundled with Drupal core, is commerce_kickstart), scroll to the
available as a packaged download, bottom of the page, and download a
and is known as a distribution. See release in the same way that you would
http://drupal.org/project/distributions download a module or theme. The
for a list of existing distributions. resulting file will be named something like
commerce_kickstart-7.x-1.10-core.tar.gz,
How to Install an Existing and this file will contain both Drupal core
Installation Profile and the Commerce Kickstart installation
There are two different ways to profile. The other option is to download
download an existing Drupal installation a fresh copy of Drupal core, and then
profile. The first (and easiest) method download the installation profile seperately,

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 83

LJDrupalSupplement.indd 83 9/15/12 9:58 AM


INDEPTH

Figure 2. The Installation Screen with Commerce Kickstart

either using a drush command like your installation profile. Mine is called
drush dl commerce_kickstart, or linuxjournal_profile, although the name
clone it directly from its Git repository, of the profile is going to be simply
and then place it within the Drupal's linuxjournal. Ive appended _profile to the
profiles directory. end of the directory name. Later, there
Now, when you go to install Drupal, will be several different directories with
there is an additional option to use similar names, so this helps provide some
the Commerce Kickstart installation clarity. Be sure to give some thought to
profile. Select the appropriate profile, the name beforehand and ensure that
click the Save and continue button, it doesnt conflict with any potential
and continue through the installation modules or themes.
process as normal. The first file I need to create is the
linuxjournal.info file that, identical to
How to Start Creating Your Own .info files for modules and themes,
Installation Profile defines the name and description of the
Outside your Drupal directory, create profile, as well as which version of Drupal
a new directory to hold the files for core that it is compatible with. Im also

84 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 84 9/15/12 9:58 AM


INDEPTH

Figure 3. The Install Screen with the Linux Journal Installation Profile

going to make it dependent on the core take effect during the installation process.
dblog and block modules so that these For now, Im just going to add an opening
are enabled automatically when the PHP tag and leave the rest of the file blank.
profile is installed: To confirm that everything works okay so
far, I can download a fresh copy of Drupal
name = Linux Journal core, copy linuxjournal_profile into the
description = A demonstration installation profile for my LJ article. profiles directory, rename it to linuxjournal
core = 7.x so that it is the same as the name of the
dependencies[] = dblog profile, and load that site in a Web browser.
dependencies[] = block So far, so good. On the installation
page, as well as seeing the default
The only other mandatory file Standard and Minimal profiles, I also can
needed for this profile to be visible to see my Linux Journal profile. I can select
Drupal is the .profile filein this case, this and continue with the installation
linuxjournal.profile. Within this file, I process as normal to confirm that its
can put any custom PHP functions or working, although because Ive not
implementations of Drupal hooks that will entered anything into linuxjournal.profile

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 85

LJDrupalSupplement.indd 85 9/15/12 9:58 AM


LJDrupalSupplement.indd 86 9/15/12 9:58 AM
LJDrupalSupplement.indd 87 9/15/12 9:58 AM
INDEPTH

yet, nothing special is going to happen. Adding Modules


Im now going to create another file
Adding a .install File called linuxjournal.make. This file
Identical to writing a module, I can create contains a listing of all the projects
a .install file that contains functions to (modules and themes) and libraries that
run when the profile is installed, updated are used within the profile. My company
or uninstalled. Im going to utilize the specializes in building accessible Web
hook_install() function from the minimal sites, and I use a number of contributed
installation profile as part of my profile modules on every site to help me do this.
instead of re-declaring its contents There are also some essential contributed
myself and duplicating code. Within my modules, such as Administration Menu
own implementation of hook_install(), (http://drupal.org/project/admin_menu)
I can include the .install file from and Pathauto (http://drupal.org/
the minimal profile and then run its project/pathauto), as well as some
minimal_install() function: custom modules and features that I use
on every site. All of these will be listed
<?php within the linuxjournal.make file.
At the very top of linuxjournal.make,
/** I need to add the following two lines
* @file to define the API version as well as the
* Install, update and uninstall functions version of Drupal core that Im using:
* for the Linux Journal installation profile.

*/ api = 2
core = 7.x
/**

* Implements hook_install(). Here is the syntax for adding a


* projectin this case, the Administration
* Run the hook_install() function from the minimal Menu moduleinto a profile. Personally,
* profile as part of this profile. I like to download projects from their Git
*/ repositories, although they could just be
function linuxjournal_install() { downloaded from drupal.org using wget.
// Utilize the hook_install() implementation from Its worth noting that the download URL
// the minimal profile. doesnt have to be a URL at drupal.org.
include_once DRUPAL_ROOT . '/profiles/minimal/minimal.install'; You can download projects from other
minimal_install(); sources, such as GitHub or BitBucket, or
} any other source, including from local

88 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 88 9/15/12 9:58 AM


INDEPTH

Figure 4. The Error on Installation

file directories: subdir value. Ive also specified which


version of the module to use and which
projects[admin_menu][type] = module branch within the Git repository to use.
projects[admin_menu][subdir] = contrib If I didnt specify a version number, the
projects[admin_menu][version] = 3.0-rc3 latest commit to the specified branch
projects[admin_menu][download][type] = git would be used.
projects[admin_menu][download][url] = To make the Administration Menu
http://git.drupal.org/project/admin_menu.git module enabled by default after
projects[admin_menu][download][branch] = 7.x-3.x installing the profile, I can declare it as
a dependency by adding the following
All modules specified will be located line into linuxjournal.info in the same
in the profiles/linuxjournal/modules way that I did for the dblog and block
directory by default; however, I prefer modules earlier:
to store contributed modules in a
subdirectory called contrib, hence the dependencies[] = admin_menu

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 89

LJDrupalSupplement.indd 89 9/15/12 9:58 AM


INDEPTH

If I update my version of Drupal Again, Im using Git to download


with these changes and try following the installation profile and providing
the installation process, I will get an the distribution with the URL to the
error because Ive made the profile repository at GitHub. With distro.make
dependent on the Administration saved, I now can compile Drupal using
Menu module, but this module hasnt the following Drush command:
been downloaded yet for this instance
of Drupal. The next step is to create drush make distro.make directory
a distribution that contains the
linuxjournal installation profile, as well The last parameter is the name of the
as all of the projects that are defined directory that you want Drupal to be
in linuxjournal.make. compiled into. If one isnt specified, the
directory that youre currently in will
Creating a Distribution be used, which I wouldnt recommend.
To create a distribution, the first I want the resulting directory to
thing I need to do is make a new file be placed in the same level as my
called distro.make that will be used linuxjournal_profile directory, so I need
to compile an instance of Drupal that to move up one level before specifying
contains the linuxjournal profile. As the name of the directory, which is
with linuxjournal.make, I need to start going to be linuxjournal_demo:
with declaring the API version and the
version of Drupal core. I also need to drush make distro.make ../linuxjournal_demo
declare Drupal core as a project as well
as include the linuxjournal profile: This command will download
the latest version of Drupal 7 core,
api = 2 as well as all projects defined
core = 7.x within linuxjournal.profile, into the
linuxjournal_demo directory. Once
projects[drupal][type] = core thats compiled everything, within the
projects[drupal][version] = "7" profiles/linuxjournal directory, there is
a new directory called modules/contrib
; Add the Linux Journal profile to the full distribution build. that contains the admin_menu module.
projects[linuxjournal][type] = profile With all of the dependencies downloaded,
projects[linuxjournal][download][type] = git I now can go to install.php again and go
projects[linuxjournal][download][url] = through the installation process without
https://github.com/opdavies/linuxjournal_demo.git any errors.

90 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 90 9/15/12 9:58 AM


INDEPTH

Adding Themes into an going to create will be linuxjournal_


Installation Profile form_install_configure_form_alter():
I can add a theme into my profile by
declaring it within linuxjournal.make in /**

the same way that I can for modules. * Implements hook_form_alter().

As I use Omega as a base theme *

for most of my themes, Ill include * Allows the profile to alter the site configuration form.

that within my profile so that its */

downloaded automatically: function linuxjournal_form_install_configure_form_alter(&$form,

$form_state) {

; Themes ========================================================= // Set a default site name.

projects[omega][type] = theme $form['site_information']['site_name']['#default_value'] =

projects[omega][version] = 3.1 t('Linux Journal Demo');

projects[omega][download][type] = git }

projects[omega][download][url] =

http://git.drupal.org/project/omega.git As the form object is passed into


projects[omega][download][branch] = 7.x-3.x the function by reference, I can add
or overwrite information within the
For now, Ill be creating the sub-theme object by using this function. Here Im
manually, so I wont change the default setting a default value for the sites
theme here. name field that will be pre-populated
on the site configuration form the
Customizing the Site next time I follow the installation
Configuration Form process. I can add and override any
When going through the installation other values on the form by adding
process, I usually make several changes them into this function:
to the site configuration formnamely
setting a default site name and adding /**

the default country. I can automate these * Implements hook_form_alter().

changes by adding an implementation *

of hook_form_FORM_ID_alter() into * Allows the profile to alter the site configuration form.

linuxjournal.profile, as any functions */

defined in this file will take effect during function linuxjournal_form_install_configure_form_alter(&$form,

the installation process. I know that the $form_state) {

ID of the form is install_configure_form, // Set a default site name and email address.

and the name of the function that Im $form['site_information']['site_name']['#default_value']

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 91

LJDrupalSupplement.indd 91 9/15/12 9:58 AM


INDEPTH

Figure 5. Site Configuration Form

= t('Linux Journal Demo'); = 'Europe/London';

$form['site_information']['site_mail']['#default_value']

= 'linuxjournal@oliverdavies.co.uk'; // Disable the 'receive email notifications' check box.

$form['update_notifications']['update_status_module']

// Set a default username and email address. ['#default_value'][1] = 0;

$form['admin_account']['account']['name']['#default_value'] }

= 'Oliver Davies';

$form['admin_account']['account']['mail']['#default_value'] Now, as well as adding a default site


= 'linuxjournal@oliverdavies.co.uk'; name, Ive also added a default site
e-mail address, a default user name and
// Set a default country and timezone. e-mail address for the first user account,
$form['server_settings']['site_default_country']['#default_value'] added a default time zone and country,
= 'GB'; and disabled the option to receive e-mail
$form['server_settings']['date_default_timezone']['#default_value'] alerts when new updates are available.

92 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 92 9/15/12 9:58 AM


INDEPTH

For security reasons, I dont want to Creating Content Types


define my password in this file and will The standard installation profile also
continue to enter this onto the form creates two default content types: basic
directly. Im using #default_value and pages and articles. Im going to re-use
not #value so I can edit these predefined most of this code to create the basic
values on the form if I need to for this page content type for my profile:
site. If I used #value, I would not be able
to do so. // Add a 'Basic page' content type.

$types = array(

Setting the Administration Theme array(

Basically, what I now have is a copy 'type' => 'page',

of the minimal installation profile 'name' => st('Basic page'),

with some additional modules and 'base' => 'node_content',

themes. The first thing I want to do 'description' => st("Use <em>basic pages</em> for

next is use the Seven theme for the your static content, such as an 'About us' page."),

administration pages of the site, as 'custom' => 1,

it would be if Id used the standard 'modified' => 1,

installation profile. To do this, I 'locked' => 0,

first need to enable Seven and then );

set some variables to set it as the );

administration theme. I can reference


the .install file from the standard foreach ($types as $type) {

installation profile to find out how to $type = node_type_set_defaults($type);

do this. To do so, I add the following node_type_save($type);

code into the linuxjournal_install() node_add_body_field($type);

function in linuxjournal.install: }

// Enable the administration theme. // Default 'Basic page' to not be promoted and don't

$admin_theme = 'seven'; // display author information.

db_update('system') variable_set('node_options_page', array('status'));

->fields(array('status' => 1)) variable_set('node_submitted_page', FALSE);

->condition('type', 'theme')
->condition('name', $admin_theme) To create additional content types,
->execute(); I can keep adding new items into the
variable_set('admin_theme', $admin_theme); $types array, and they will be processed
variable_set('node_admin_theme', '1'); within the foreach() loop.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 93

LJDrupalSupplement.indd 93 9/15/12 9:58 AM


INDEPTH

Adding Text Formats and a 'weight' => 10,


WYSIWYG Editor 'status' => 1,
When you use the standard installation ),
profile, several different text formats ),
are created. Currently, I have only plain );
text and PHP code (because the PHP $text_formats['full_html'] = array(
module is now also a dependency for 'format' => 'full_html',
my profile). I also want the additional 'name' => 'Full HTML',
text formats, so Ill copy that section of 'weight' => 1,
code from the standard.install file and 'filters' => array(
paste in into the linuxjournal_install() // URL filter.
function: 'filter_url' => array(
'weight' => 0,
// Add text formats. 'status' => 1,
$text_formats['filtered_html'] = array( ),
'format' => 'filtered_html', // Line break filter.
'name' => 'Filtered HTML', 'filter_autop' => array(
'weight' => 0, 'weight' => 1,
'filters' => array( 'status' => 1,
// URL filter. ),
'filter_url' => array( // HTML corrector filter.
'weight' => 0, 'filter_htmlcorrector' => array(
'status' => 1, 'weight' => 10,
), 'status' => 1,
// HTML filter. ),
'filter_html' => array( ),
'weight' => 1, );
'status' => 1, $text_formats['raw_html'] = array(
), 'format' => 'raw_html',
// Line break filter. 'name' => 'Raw HTML',
'filter_autop' => array( 'weight' => 2,
'weight' => 2, );
'status' => 1, foreach ($text_formats as $text_format) {
), $text_format = (object) $text_format;
// HTML corrector filter. filter_format_save($text_format);
'filter_htmlcorrector' => array( }

94 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 94 9/15/12 9:58 AM


INDEPTH

Ive amended the format slightly by projects[wysiwyg][download][branch] = 7.x-2.x

creating an array called $text_formats,


and then using a foreach loop to projects[libraries][type] = module

save each one as opposed to doing projects[libraries][subdir] = contrib

them separately as it is done in projects[libraries][version] = 2.0

standard.install. I also usually create projects[libraries][download][type] = git

a Raw HTML format that allows all projects[libraries][download][url] =

HTML tags and doesnt have any http://git.drupal.org/project/libraries.git

filters applied to it, so Ive added it projects[libraries][download][branch] = 7.x-2.x

here as an additional format to be


created automatically. libraries[tinymce][type] = library

libraries[tinymce][download][type] = get

Adding TinyMCE and Enabling It libraries[tinymce][download][url] =

for Certain Text Formats http://github.com/downloads/tinymce/tinymce/tinymce_3.5.6.zip

I also download and install the


WYSIWYG module and the T inyMCE In linuxjournal.info:
editor for each site. Rather than
having to download and enable the dependencies[] = libraries
WYSIWYG module, download and dependencies[] = wysiwyg
extract the TinyMCE library and
configure the editor, I can add it into TinyMCE will be downloaded and
my profile to have it done automatically. extracted into the profiles/linuxjournal/
First, I need to add the WYSIWYG profiles directory and will be accessible
(http://drupal.org/project/wysiwyg) by the WYSIWYG module once Libraries
and Libraries API (http://drupal.org/ API is enabled. However, now that it has
project/libraries) modules and add them been downloaded, I need to assign it to
into dependencies to have them enabled one of my text formats before it can be
by default. used. The format Im going to assign it
In linuxjournal.make: to is Filtered HTML, and I can do that by
adding a record into the wysiwyg table
projects[wysiwyg][type] = module in the database. Ive also added an array
projects[wysiwyg][subdir] = contrib of default settings that Ive used on
projects[wysiwyg][version] = 2.1 another site, and Ive added this into the
projects[wysiwyg][download][type] = git drupal_write_record() function:
projects[wysiwyg][download][url] =

http://git.drupal.org/project/wysiwyg.git // Add the TinyMCE editor to the Filtered HTML text format.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 95

LJDrupalSupplement.indd 95 9/15/12 9:58 AM


INDEPTH

$tinymce_settings = array( 'preformatted' => 0,

'default' => 1, 'convert_fonts_to_spans' => 1,

'user_choose' => 0, 'remove_linebreaks' => 1,

'show_toggle' => 0, 'apply_source_formatting' => 0,

'theme' => 'advanced', 'paste_auto_cleanup_on_paste' => 1,

'language' => 'en', 'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div',

'buttons' => array( 'css_setting' => 'theme',

'default' => array( 'css_path' => '',

'bold' => 1, 'css_classes' => '',

'italic' => 1, );

'strikethrough' => 1,

'justifyleft' => 1, // Create the record.

'justifycenter' => 1, $record = array(

'justifyright' => 1, 'format' => 'filtered_html',

'justifyfull' => 1, 'editor' => 'tinymce',

'bulllist' => 1, 'settings' => $tinymce_settings,

'numlist' => 1, );

'link' => 1,

'unlink' => 1, // Save the record to the database.

'anchor' => 1, drupal_write_record('wysiwyg', $record);

'image' => 1,

'formatselect' => 1, Its worth noting here that the


'sup' => 1, $tinymce_settings variable needs to be a
'sub' => 1, standard PHP array as it will be serialized
'blockquote' => 1, automatically when it is written into the
'code' => 1, database table. When I first tried this,
'hr' => 1, I tried importing a pre-serialized array
'removeformat' => 1, into the database, which subsequently
'charmap' => 1, generated errors when trying to view the
), WYSIWYG admin settings form.
),

'toolbar_loc' => 'top', Creating Additional User Roles


'toolbar_align' => 'left', and Assigning Permissions
'path_loc' => 'bottom', All of the Drupal sites that we build at my
'resizing' => 1, company have a moderation workflow
'verify_html' => 1, in place provided by the Workbench

96 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 96 9/15/12 9:58 AM


INDEPTH

Figure 6. The Additional Roles

Moderation module (http://drupal.org/ // Editors and Publishers.

project/workbench_moderation). This $roles = array('Developer', 'Administrator', 'Editor', 'Publisher');

requires creating some additional roles for foreach ($roles as $weight => $name) {

users who can edit and publish content. I $role = new stdClass;

also usually create a Developer role for use $role->name = $name;

by any of the other Developers in the team $role->weight = $weight + 2, // New roles must have at

that has permissions to all of the modules on // least a weight of 2.

the site, as well as an Administrator role for


users who need more administrative access // Save the new role.

than Editors and Publishers, but who dont user_role_save($role);

need full Developer-level access. Again, I can


reference a section of code from standard. if ($name == 'Developer') {

install and use that as a template: // Give the Developer role all permissions.

user_role_grant_permissions($role->rid,

// Create new user roles for Developers, Administrators, array_keys(module_invoke_all('permission')));

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 97

LJDrupalSupplement.indd 97 9/15/12 9:58 AM


INDEPTH

permissions for the Filtered HTML and


// Set this as the administrator role. Raw HTML text formats that I created
variable_set('user_admin_role', $role->rid); earlier. Anonymous users are going
to have very restricted permissions
// Assign user 1 the Developer role. and are only going to be able to
db_insert('users_roles') access content and use the Filtered
->fields(array('uid' => 1, 'rid' => $role->rid)) HTML permission. The authenticated
->execute(); users also will be able to access the
} Administration Menu and information
from the Devel module, as well as
Ive created an array containing the the Filtered HTML and Raw HTML
names of the new roles I want to create, text formats.
and then a foreach() loop including the These are just a few examples of
key of each item that will be used to what can be done using installation
define the weight for each role. The first profiles and distributions, and
section applies to all new roles where Ive shown some of the ways I
the role is created, and then there is an automate the Drupal installation and
additional section that applies only to the configuration processes. The complete
Developer role. This section assigns all installation profile Im currently using
permissions to the Developer role as well at Nomensa also includes custom
as assigning the role to user 1. themes with theme template overrides
W ith the new roles created, I now that then can be used on custom
can set some default permissions: public-facing and administration
themes and additional Drupal
// Assign some default permissions. configuration. This has saved me hours
$filtered_html_permission = of time in the initial development
filter_permission_name($filtered_html_format); stages as opposed to having to redo
$raw_html_permission = filter_permission_name($raw_html_format); the same steps each time I start
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, developing a new site.
array('access content', $filtered_html_permission));

user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, Oliver Davies is an Application Developer at Nomensa,


array('access content', 'access administration menu', specializing in Drupal and PHP development. Outside
'access devel information', $filtered_html_permission, work, Oliver is a keen contributor to the Drupal
$raw_html_permission)); communityattending local user groups, maintaining
several of his own contributed modules, and blogging
To start, I find out the name of the about the latest Drupal developments and issues.

98 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 98 9/15/12 9:58 AM


INDEPTH

Trekka Drupal
Distribution for
Universities
Take a close look at how Trekk uses Flatfish to scrape and
share content.
TIM LOUDON

Trekk is a new, innovative Drupal departments. Traditionally, duplicate


distribution focusing on higher content is either (tediously) maintained,
education. Trekks primary goals are to out of date or simply but sub-optimally
enable flexible and intelligent content omitted. Trekk aims to solve these key
sharing and to simplify launching on problems for you. Given that universities
to Drupal. As one of Trekks main often have dozens of key Web sites
developers, I definitely can say that Trekk and thousands of pages of content, the
just wants to make your life easier. other half of Trekk focuses on migration
A couple outstanding Drupal onto Drupal.
distributions already exist (Open Scholar If youve ever dealt with homegrown
and Open Academy), so I want to PHP sites, Oracles dismal 64-bit Linux
outline some use cases to help illustrate support, dual-booting Windows to run
Trekks niche. Primarily, Trekk assumes Microsoft SQL Server or just a whole
you either have or want to have several mess of static HTML pages, you know
Drupal sites that display the same why I wrote Flatfish (if not, take my word
content. For example, the PR team wants that there was sufficient motivation).
important news and events to show Flatfish is a Ruby gem that abstracts the
up on every schools or departments legacy platforms technology stack, so
Web site, or several professors are you can use CSS selectors la jQuery to
cross-listed on department or school scrape only the content you want. Trekk
sites, or a certificate program contains then provides built-in support to clean
course information spread across several and migrate this data into Drupal.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 99

LJDrupalSupplement.indd 99 9/15/12 9:58 AM


INDEPTH

When I talk about sharing content unique requirements. The Trekk client
across sites, I really mean more than that. is robust and uses Migrate under the
If you just wanted to display some simple hood to create the Drupal nodes. There
content on two or more sites, you could is the added benefit of controlled
do that using Drupal core and standard updates and access to the Migrate
contrib. The Views module could provide plugin ecosystem. And, returning to the
an outbound RSS feed, and the other Views+Feeds comparison, Trekk preserves
site(s) could use Feeds to consume the relationships. If theres a Faculty content
content. This architecture falls down type and a Publication content type, the
though when you have complex data connections between the nodes on the
and/or what I would call a real-world server are passed on to the clients.
workflow. Trekk conceptually builds on As for Flatfish, youre probably
this Views+Feeds approach to create a wondering, Why would a PHP Drupal
lightweight content server. A Trekk server developer create a tool in Ruby? When
uses Views and Services to expose JSON I initially designed Flatfish, I knew that I
endpoints. Trekk clients then can access wanted something flexible, dynamic and,
the server securely and get the content honestly, a bit magical (but hopefully
they need. not cryptic). Ruby seemed like an ideal
Additionally, Trekk clients can choice, but two libraries made it the
manipulate the data into multiple only one: Nokogiri and Active Record.
formats. For example, a client site can Nokogiri is an awesomely cool Ruby
consume the JSON and create Drupal gem that provides CSS selectors as well
nodes. This lets the client site control as XPath for XHTML and XML. The end
the display through the use of Views, result is fine-grained control over what
Display Suite or Panels. You also could HTML gets scraped. This has worked out
write a simple extension to the Trekk surprisingly well, even on pure HTML
Server to share HTML, and then client sites where there arent CMS templates
sites could show this directly via Panels. to force all the desired content into
It allows for a tremendous amount of the div#main or div#content. The other
flexibility in how the client sites use the library, Active Record, is one of Ruby
shared content. This is key in helping on Rails core libraries. It provides an
school and department sites maintain ORM, so all persistent data manipulation
their autonomy, but it also allows for in Flatfish is done via Objects. This
better brand compliance and centralized has been incredibly handy, as Flatfish
control where appropriate. Trekk allows creates database tables on the fly
you to build a system that meets your and adapts those tables to mirror the

100 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 100 9/15/12 9:58 AM


INDEPTH

Table 1. Contents of bio.csv


URL Path Body field_position

http://drupalconnect.com/ bio/john-florez John Florez .field-name-field-user-bio


team/john-florez .field-name-field-user-position .field-item

http://drupalconnect.com/ bio/jonathon-whitener Jonathan .field-name-field-user-bio


team/jonathon-whitener Whitener .field-name-field-user-position .field-item

http://drupalconnect.com/ bio/tim-loudon Tim Loudon .field-name-field-user-bio


team/tim-loudon .field-name-field-user-position .field-item

http://drupalconnect.com/ bio/mike-crittenden Mike .field-name-field-user-bio


team/mike-crittenden Crittenden .field-name-field-user-position .field-item

http://drupalconnect.com/ bio/christopher-jones Christopher .field-name-field-user-bio


team/christopher-jones Jones .field-name-field-user-position .field-item

destination Drupal systems content gem. This usually means typing sudo
types transparently. Outside of Active gem install flatfish . If youre
Record and Nokogiri, Flatfish handles the struggling here, any guide on installing
mundane migration detailsnormalizing Rails should help, or you can try using
links and tokenizing and saving media as rbenv+ruby-build or RVM to assist with
binary blobs. the installation and management of Ruby
Now that you know a little about Trekk versions, implementations and gemsets.
and Flatfish, lets get our neckbeards However, be aware that rbenv and RVM
on and walk through an example. For come with their own set of concerns and
Flatfish, download Ruby 1.9.3, and are recommended for those interested
install all of the soft dependencies in Ruby beyond Flatfish. Finally, theres
(also save yourself some time and also an IRC channel: #trekk. For gem
install libxml2-dev, libxslt-dev and version incompatibilities, use the
mysqlclient-dev or your distros Flatfish GitHub Issues.
equivalentsgem dependencies). A Using Flatfish is straightforward. The
note on the soft dependencies, Ruby program parses a CSV. Each row contains
will install without them, but you dont the URL to be scraped, metadata about
want that so be sure to grab them, the URL for Drupal and one or more
in particular libyaml. Rubygems, your columns of CSS selectors. Each CSS
PHP PEAR/PECL equivalent, comes with selector maps to a Drupal field.
Ruby, so now you can install the Flatfish For an example, lets scrape the Drupal

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 101

LJDrupalSupplement.indd 101 9/15/12 9:58 AM


INDEPTH

Connect Web site and populate a Bios Now copy the YAML file below
Content Type as well as a handful of blog and change the values to match
posts to demonstrate the media handling. your specifics:
The first step is to create the CSVs. The
bio CSV contains a header row with URL, # DB credentials

title, path, body and an extra field for db_user: 'root'

the employees position or title within db_pass: 'correcthorsebatterystaple'

the company. Lets use the machine name db: 'flatfish_sample'

for the position field, field_position. The


blog posts will correspond to Drupal # NOTE: these map to Drupal content types

Articles and dont have any extra fields. # and AR database tables

The full bios CSV as well as the articles types:

CSV are available in the Flatfish repo on Bio:

GitHub. You can see that the CSS classes csv: '/home/tloudon/lj/example/bio.csv'

match the DC sites bio and position. host: 'http://drupalconnect.com'

For each URL, you eventually will have Article:

a Drupal node. The HTML from the csv: '/home/tloudon/lj/example/article.csv'

.field-name-field-user-bio selector will host: 'http://drupalconnect.com'

go in the Drupal node body, and HTML


from the .field-name-field-user-position # use the web, otherwise path to local HTML root

.field-item will go in the node position local_source: ''

field. The aforementioned metadata


includes the Drupal node URL alias and As implied, Flatfish supports scraping
node title. Note that Flatfish dynamically multiple Content Types in a single
creates table schemas, so you can add as session; just add them into the file as
many CSV columns after body as you shown below or see the GitHub repos
need. And although its not used here, example directory. Also, dont forget
theres concatenation support. This comes to create the database. Subsequent
in handy if you need to skip an image or migrations can use the same database
menu in the middle of your target URLs and will update the content, keeping
content. For example, if a CSS selector the same IDs. And, thats it; setup
fields value is #main-content p.one && is complete.
#main-content p.three, Flatfish would Flatfish supplies a binary (remember
concatenate the text of those two CSS to exec $SHELL to update your
selectors ostensibly skipping HTML in the $PATH right after the gem install), so run
#main-content p.two tag. flatfish in a terminal in the directory

102 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 102 9/15/12 9:58 AM


INDEPTH

with config.yml. During runtime, Flatfish the drush makefile as specified in the
will pull down the content over the Net README.md, and choose a Trekk
and update all of the relative links. (There Server with Flatfish Support.
also is support for a local importation The Flatfish module needs access to
if you have a copy of the site or use the config.yml, the Flatfish generated
wget to mirror it, which can speed up schema.yml and the scraped HTML
the migration substantially.) Flatfish will database. Create a new directory called
create two or more database tables: a flatfish_migrations in sites/all, and
media table and one for each Content place the YAML files in it. Review the
Type. Any files (images, PDFs, docs and so generated schema.yml file, and ensure
on) referenced in the CSS selected HTML that each Content Types machine_name
are saved in the media table. Flatfish matches the Drupal Content Type
considers URLs unique, so only one copy machine name. (Note: Rails pluralizes
of an image or file is saved even if there database tables, so a Flatfish Bio
are multiple references to it. Note that type has a bios table and matches a
the scraped HTML now has tokens to the bios Drupal content type.) Navigate
media table. Take a moment to query the to admin/structure/flatfish. The Flatfish
database and verify that all content saved module parses the YAML files and
correctly. Again, Flatfish supports updates dynamically creates the configuration
and maintains IDs, so you can rerun page items. When you visit the Flatfish
Flatfish several times during a session or module configuration page, the items are
during the course of a project. registered as Migrate classes. This means
On the Drupal side, weve created a database tables are created to store
Flatfish module thats included in Trekk important Migration data, and you now
or available on drupal.org. Trekk has a can see and run the Migrations under
drush makefile to download Flatfishs admin/content/migrate.
required libraries; however, you also can As implied above, all media, regardless
download them manually (queryPath, of content type, is stored in the same
HTMLPurifier and Spyc). Spyc provides database table. Run the media Migration
YAML support; queryPath replaces the first; this will create the physical files and
media tokens, and HTMLPurifier strips add them to the file_managed database
out all nonsemantic markup. The heart table. The files are now accessible
of the module uses Ctools plugins under admin/content/media and are no
and Migrate to provide a reasonably different from any other natively created
automated, dynamic migration. Drupal files.
Download the Trekk tarball, run Next, run all Node/HTML Migrations.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 103

LJDrupalSupplement.indd 103 9/15/12 9:58 AM


INDEPTH

Figure 1. Flatfish Module Configuration Page

Figure 2. Migrate UI

104 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 104 9/15/12 9:58 AM


INDEPTH

Figure 3. Example migrated content: node/edit sample showing migrated


title, body and position; sample image in a responsive design blog post;
and a thumbnail of admin/content.

As mentioned previously, each URL will notice that the HTML is clean.
from the CSV corresponds to a Drupal HTMLPurifier accepts a comma-
node. Because the HTML has simple delimited whitelist of HTML tags with
Flatfish media tokens, its important attributes. Flatfish has defaulted to
that you run the media Migration stripping all divs, spans, classes and
first, so that the files exist in Drupal ids. Although this may change if it
and the system will update them. If proves to be controversial, the Flatfish
you skipped the media first, click the module strips HTML table tags as well.
update check box, and run the Node/ In my experience, legacy HTML tends
HTML Migrations again. You also toward table-driven layout rather than

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 105

LJDrupalSupplement.indd 105 9/15/12 9:58 AM


INDEPTH

legitimate tabular data presentation. modules. We have written a custom


If you need to import tables, either Views handler that outputs JSON. And,
hack the module (and kill a kitten) Services provides a RESTful endpoint
and add the three HTML table tags that client servers can contact securely.
to the whitelist, or file an issue on Next create a View. For this example,
drupal.org, so we can see if there is lets create one for the Bios Content
a community need for a configurable Type. This is a normal View and can
whitelist. The major advantage of the use filters, contexts, relationships and
HTML stripping is that it allows the so on. Now configure your Services
Drupal theme to define the layout Server. We recommend the REST server.
without worrying about or writing At the time of this writing, you will
overrides for the legacy HTML. need to symlink the Spyc PHP file that
However, there also can be a huge Trekks drush makefile installs in
compliance benefit in that any insecure sites/all/libraries to the rest_server/lib
HTML (inputs, forms), JavaScript or directory. Check your endpoint
iframes also are removed. configuration, and enable the View
Now that the example content is in as a retrieve resource. Services
Drupal, lets look at sharing it. Trekks Servers can set authentication and
server code is fairly lightweight and have configurable paths. The
builds upon several other Drupal example endpoint is available at

Figure 4. Example Services Server

106 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 106 9/15/12 9:58 AM


INDEPTH

http://localhost/api/bios/
Listing 1. Trekk Client Source Snippet default where api is
the Services path, bios
/** is the View name, and
* Implements hook_trekk_client_source_schema() default is the View
*/ display. You also can add
function bio_example_trekk_client_source_schema() { query string parameters like
$schema = array(); output=html to show HTML.
Note, other examples and
$schema['bio_example'] = array( details are contained within
'name' => 'bio_example', the Trekk distribution. The
'label' => t('Trekk Bio Example'), Trekk Server is now set up.
'fields' => array( Covering the creation of
'nid' => array( a Trekk Client in detail is
'type' => 'int', beyond the scope of this
'length' => 11, article; instead, I review the
'unsigned' => TRUE, basic process. First, create
'not null' => TRUE, a second instance of Trekk,
), this time selecting the Trekk
'node_title' => array( Client option. Trekk clients
'type' => 'varchar', use Migrate and need custom
'length' => 255 code to parse and import the
), data thats retrieved from the
'body' => array('type' => 'longtext'), server. So, each Trekk Client
'position' => array( has custom code tailored to
'type' => 'varchar', the shared content. This code
'length' => 255 is composed of three primary
), parts: a Source, a Destination
), and a Mapping. (Note: there
'primary key' => array('nid'), are examples within the
); Trekk distribution.)
Youll need to navigate
return $schema; to admin/config/services/
} trekk_client and add a new
Trekk Client configuration
item. You can define the Trekk

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 107

LJDrupalSupplement.indd 107 9/15/12 9:58 AM


INDEPTH

Figure 5. Example Bio Configuration

Server URL as well as the HTTP method, and each field would have the data
but the Source schema implements type (int, varchar and so on) and length
hook_trekk_client_source_schema(). The where appropriatesee Listing 1 for an
schema is essentially a database-friendly illustration. The only hitch is that the
version of the structure the Trekk Server Trekk Server converts a View into JSON,
endpoint outputs. For example, your bio so it uses the View field labels instead
schema would have nid, node_title, of the machine name as you have in
body and position as the fields, other areashence, position and not

108 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 108 9/15/12 9:58 AM


INDEPTH

field_position. Once you have configured MappingsTrekk handles Mappings a


the Source, you can Test Connection little differently from normal Migrations
and verify that the Trekk Client can access and expects Mappings to come in as
the Trekk Server, although this does not configuration rather than as part of a
validate the schema. Migration class constructor. For a full
Trekk extends Migrates node and understanding, I recommend reviewing
term Destinations to make them TrekkClientMapping.inc in detail.
accessible to the GUI. However, many You now should have content on the
contrib modules provide Migrate Trekk Client. From here, just write a
Destinations, and Migrate maintains simple drush script to execute Migrate
several as well in the migrate_extras updates and set up a cron job. The
module. For example, the Flatfish Trekk Client content will be up to date
module media Migrations use the Media and largely maintenance-free.
Destination to create the physical files As you can see from this overview
and populate the file_managed table and example, Trekk provides a great
properly. In many cases, you will be starting point for universities looking to
able to use the node Destination. For leverage Drupal in a big way.
complex Migrations, you may need to
extend Destinations or write your own. Tim Loudon is the VP of Engineering at Drupal Connect, a
Finally, you will need to add a full-service Drupal development shop. He has been working
Mapping. Although Mappings can be with Drupal since 2008 and has had the opportunity to work
very simple, they are more than just with some fantastic clients on some amazing sites. Recently,
the connection between the Source Tim has slung code for the Stanford School of Engineering
and the Destination. Mappings also and the Stevens Institute of Technology.
provide a key juncture to insert custom
processingyou can register custom
callbacks. For example, although we Resources
use the standard node Destination
Trekk Home Page:
in the Flatfish module Content Type http://drupalconnect.com/trekk
Migrations, a callback executes
The Flatfish Repo:
more than 100 lines of custom https://github.com/drupalstaffing/flatfish
code. This is the code that cleans
The Flatfish Module:
the HTML, handles the non-Media
http://drupal.org/project/flatfish
file creation (PDFs, docs and so on)
and replaces the Flatfish tokens with Trekk IRC Channel: #trekk

Media tokens. One last note on the

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 109

LJDrupalSupplement.indd 109 9/15/12 9:58 AM


INDEPTH

Creating and
Theming a
Custom Content
Type with Drupal 7
Make the most of your content strategy by building and
theming custom content types using Drupal 7. In this article,
I show how to design an Event content type, leveraging some
features with this content management framework.
DANNY ENGLANDER

One of the great new things about types. These might include events, press
Drupal 7 is that its now easier to releases, FAQ, staff, photo gallery and
customize your site content. In Drupal more. What makes these unique? Its all
6, you typically had to use the CCK about the Fields that you add to your
(Content Construction Kit) module for content type.
fine-grained control in customizing A Field is an attribute for the content
content, but that has been folded into type, and these attributes are types of
core for Drupal 7. Drupal 7 is now a true information associated with your content.
content management framework (CMF). If you have an Event content type, you
might need to add date, location and link
Drupal 7: Its All about Fields attributes. Each of those can be realized
When you customize content in Drupal through the use of Fields.
7, it involves creating or modifying
whats often referred to as a content Theming and Nodes
type. Drupal 7 comes with two defaults: A Drupal 7 Node is simply an individual
Page and Article. When building a site, page with content thats rendered using
you often need additional content a specific content type that contains

110 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 110 9/15/12 9:58 AM


INDEPTH

Figure 1. Drupal 7 Administrator Toolbar

Figure 2. The content type landing page is where you can edit your content types and
manage their fields and display.

all of your fields. Fields are extremely too much code. There also are other ways
flexible, and there are many possibilities to theme a node, including custom node
for display and theming them, depending templates and the Panels module.
on what you want to do. Theming, in Drupal 7 comes with basic default
regard to Drupal, is the presentational fields, such as Text, Long text, File, Image
layer of the code and content, and there and List. There also are many additional
are various ways to achieve theming Field types that can be added via
from some simple changes in the Drupal contributed (contrib) modules.
Admin UI to more complex custom node
templatesfor example, node--custom. Manage and Edit
tpl.php. In this tutorial, I use the Display To gain insight into existing content
Suite module for theming our node. Its types and Fields on your site, navigate
a visual interface that allows for custom to /admin/structure/types, or use the
layouts without really needing to know admin toolbar: StructureContent types.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 111

LJDrupalSupplement.indd 111 9/15/12 9:58 AM


INDEPTH

Figure 3. You can manage existing fields for an individual content type and add new
ones with a select menu.

Figure 1 shows the administrator Fields and a select menu to add new ones
toolbar at the top of the Admin Drupal for a content type.
UI in the browser. Youll use this a lot
to navigate the admin area for various Tools Needed
tasks. This assumes you have admin Now that you have a basic overview of
access to a Drupal site or at least have how content types work, let me show
been given the proper permissions by you how to build a new one and theme
an admin to see and use the toolbar. it. For this example, lets create and
On the content type landing page, as theme an Event content type. You will
shown in Figure 2, you can see existing need a few additional contrib modules
types, and you would add new ones here. available from drupal.org. Ideally, to
You also can edit a content type, add follow along with the tutorial, youd
and edit Fields, and manage its display want a fresh install of a Drupal 7 site,
from this page. Figure 3 shows existing and download and set the default theme

112 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 112 9/15/12 9:58 AM


INDEPTH

to the Professional Theme. called drush where you can install core
If you are not familiar with how to and download contrib modules, but for
install Drupal, its actually not that the sake of this tutorial, Im using the
hard, and you can install it in a LAMP Drupal Admin UI. If you really decide to
environment. If you already have a dive in head first to Drupal, drush can be
local development machine with LAMP, a huge time saver.
its a matter of creating a new MySQL
database and following a point-and-click Mock It Up
GUI install for Drupal. There are links at When creating a new content type, I
the end of this article in the Resources like to do a quick mock-up to get a
section for some basic Drupal install better picture of how I want the finished
information. Note that Drupal has an product to look. Figure 4 shows what I
entire command-line utility of its own came up with for my Event.

Figure 4. Mock-up of how an Event page will look.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 113

LJDrupalSupplement.indd 113 9/15/12 9:58 AM


INDEPTH

Essential Modules n Libraries


The mock-up helps determine which
modules Ill use. You can find links n Display Suite
for these in the Resources section.
Contributed modules and Theme n Professional Theme
(contrib) required the following:
Core Fieldsincluded with Drupal 7
n Date (no need to download):

n Get Locations n Image

n Geocoder n Overview (Long Text/Textarea)

n GeoPHP Now that you know what modules and


Theme you are going to use for building
n Chaos tool suite (ctools) your Event content type, download the
latest stable recommended release from
n Link drupal.org (highlighted in green on its
project page). The recommended release

Figure 5. The latest recommended release of a module is shown highlighted in green


(7.x-1.5 in this case). Dev releases are red, and a new 2.x beta branch is yellow.

114 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 114 9/15/12 9:58 AM


INDEPTH

should be sufficient, but there may be API, Date popup and Display Suite, and
times when you run into a bug and need then click Save configuration.
to use the latest dev release. Figure 5 Using the admin toolbar, click on
shows an example of release information Appearance, and activate the Professional
for a contrib module on drupal.org. Theme listed under Disabled Themes. Use
Download the modules, untar them, the Enable and set default setting that
and put the resulting folders in the will enable it and bring it up to the top
/sites/all/modules folder from Drupal root. under Enabled Themes.
Although you will see a Modules folder
at root, never add third-party modules Get a Google API v3 Key
to this one; its a core folder that gets Youll need to add a Google Maps
updated or changed only when a core JavaScript API v3 Key to display a
Drupal release comes out. Likewise, map for an event location. Go to the
download the Professional Theme, untar Google API console and log in with
it, and put it in /sites/all/themes. your Google account (or create a
You also need to download some map Google account if you havent already).
markers from the Get Locations project See Resources for links. Once logged
page. The getlocations-markers.tar.gz in, generate a new key, or use an
file should be sufficient. Untar this existing one from the API Access tab.
file, and put it in sites/all/libraries/ Back in Drupal, use the admin toolbar
getlocations/markers. Most likely you to go to Configuration, and then under
will have to create the Libraries folder Web Services, click on Get Locations.
on a new Drupal install, but if it exists Expand Google API Key, enter your key,
already, simply make a new folder and save the configuration.
within that called getlocations, and
then put the newly untarred Markers Set Your Locale and Create a
folder within that. Custom Date and Time Format
Now is a good time to set your sites
Activate Contrib Modules Locale as well. From the toolbar,
and Theme go to ConfigurationRegional and
Go to the Drupal Modules Admin page LanguageRegional settings or admin/
located at /admin/modules, or from the config/regional/settings. Chances are
admin toolbar, click on Modules. Check your default time zone already is set,
the check boxes for Get Locations, but its good to confirm or adjust
Getlocations Fields, geoPHP, Geocoder, it. Accept all other defaults here
Libraries, Chaos tools, Link, Date, Date and save. Also, from Regional and

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 115

LJDrupalSupplement.indd 115 9/15/12 9:58 AM


INDEPTH

Language, click on Date and time, Style, type in event_photo , and


located at admin/config/regional/ save. Under Effects, choose Scale in
date-time, and then the Formats tab. the Select New Effect select list. For
Lets create a custom date format. width, choose 375, and save (Add
Its pretty straightforward, and youll effect). The new effect is saved, and
use standard code from the PHP Date you will refer to it later.
Manual (see Resources). Once on the
Date and T ime formats page, click Add Build It
Format. In the Format string text box, Now, go to StructureContent types from
copy and paste (or type) in this string: the admin toolbar, and click Add content
type. You now get a new page with
l F j, Y- g:i a T options. You can pretty much accept the
defaults here, but lets customize a little:
You will see that it immediately renders
as a nicely formatted date like this: n Name: Event.

Sunday August 12, 2012- 11:00 am PDT n Description: a custom content to


display company events.
Lets give this new format a name.
Go back to the main Date and T ime n Publishing Options: uncheck Promoted
page you were just on, and click Add to front page.
date type. Lets call it Full date with
time zone for Date type. For Date n Display Settings: uncheck Display
Format, choose from the select menu, author and date information.
and most likely the new format you
just created will be the last item in n Comment Settings: set to Hidden
the menu. Choose that, and save (Add under Default comments setting for
date type). The new Date Type is saved new content.
(youll refer to it later).
n Menu settings: uncheck Main Menu.
Create an Image Style
For the event image, youll want a Save the content type. Back on the
custom style. Using the admin toolbar, content types landing page, you now
click on Configuration and then will see Event (Machine name: event),
MediaImage Styles or go to /admin/ in addition to Basic page and Article, as
config/media/image-styles. Click Add shown in Figure 6.

116 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 116 9/15/12 9:58 AM


INDEPTH

Figure 6. The Newly Added Event Content Type

Add Fields 7. Click on More Settings and Values.


Now youre ready to add/edit your 8. Now for Date Entry Options, choose
custom event fields. Click manage fields a format from the select list. Ideally,
for Event. Youll see that the Body Field choose something that shows the
already exists. Click to edit on Body, day, month, year and time with
and simply change the Label to Event the desired time format (whether
Overview, and save the settings. its 24-hour time or am/pm)for
example, Aug 10 2012 - 3:30:13pm.
Add a Date Field:
1. On EventManage Fields under Add Add a Location Field:
new field, type in Event Date . 1. On EventManage Fields under Add
2. Type Date (ISO format). new field, type in Event Location.
3. Widget Pop-up calendar. 2. Type Geolocations Fields.
4. Click Save. 3. Widget Geocoder.
5. Now on Field Settings, accept the 4. Save, and on the next screen for
defaults and save again. Search options, choose No Search box.
6. On the next screen, check Required 5. Save, and on the next screen, check
Field. Required field.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 117

LJDrupalSupplement.indd 117 9/15/12 9:58 AM


INDEPTH

Figure 7. The finished Fields page for Event. You can re-order the fields by dragging the
little + icons under the label, but you must save the page after doing so.

6. Accept all other defaults here, and 3. Widget Image.


save again. 4. Save, accept defaults, and save again.
5. On the next screen, check Required field.
Add a Link Field: 6. Check the Alt and Title fields, and save.
1. On EventManage Fields under Add
new field, type in Event Link . Figure 7 shows the finished Manage
2. Type Link. Fields page. Note that you can drag the
3. Widget Link. fields around to re-order them with the
4. Save, and on the next screen, simply little + icons, but when you do, you need
save again. to save the page again.
5. On the next screen, make required As you might have noticed when
and choose Required Title, and save. creating all these fields, there are dozens
of other options for customization, and for
Add an Image Field: the most part, you accepted many of the
1. On EventManage Fields under Add defaults. However, as you get more into
new field, type in Event Image . Drupal site building, youll want to explore
2. Type Image. these options and experiment with them.

118 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 118 9/15/12 9:58 AM


INDEPTH

Note that you can drag the fields around to


re-order them with the little + icons, but when
you do, you need to save the page again.

Manage Your Display your display. Using the admin toolbar,


Now you just need to do a little head back to StructureContent
theming using the Manage Display typesEventmanage display.
tab for your Event content type. This Using the select lists and drag
will be a two-part process. The first is icons, make your layout to look like
to get some reasonable defaults for Figure 8. Note the Gear icons at the

Figure 8. The Configured Layout after Adjusting Labels and Settings

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 119

LJDrupalSupplement.indd 119 9/15/12 9:58 AM


INDEPTH

Note the Gear icons at the far right; you can


click on those to fine-tune your settings, but
always remember to choose Update, and then
save the page after any changes.

far right; you can click on those to At the bottom of Manage Display,
fine-tune your settings, but always find the tab called Layout for event in
remember to choose Update, and default. Click, and using the Select a
then save the page after any changes. layout list, choose Two Column, and
Youll notice with the Date and save the page. Youll notice you have
Event photo, you now have the an updated UI showing Right, Left and
respective format and style you Disabled. All Fields default to Disabled,
created previously. so position the Fields where you want
Lets add in a Display Suite layout; them in your new two-column node
this is where all the magic happens. layout. You either can drag your Fields

Figure 9. The Finished Display Suite Layout

120 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 120 9/15/12 9:58 AM


INDEPTH

up to the right or left area or use the From the admin toolbar, click
Region select list to choose. I find the on Content, and then choose Add
latter to be easier. Figure 9 shows the content, and choose Event. You now
layout after repositioning Fields and will see a blank node create form.
saving the page. Fill in a T itle, choose your Date, and
fill in some Overview Text. Next,
Add CSS to the Theme choose an address for your event, and
By default, the two-column Display once its filled in, click the Geocode
Suite layout is split 50%, but lets add this address button, and your little
some CSS to our theme to mirror the map below will re-center itself on
wireframe. Open styles.css, located at your address. Finally, upload an
sites/all/themes/professional_theme/, image, choose a link/title, and save
and add this code after the final your node. Figure 10 shows the final
closing brace at the end of the file. themed layout.
Youll notice this CSS file has media
queries in it, and for the sake of this
demo, lets add our styles in after any
media query, but you also could theme
this per media query:

.group-right {
width: 36%;
padding-left: 2%;
float: right;
}

.group-left {
width: 62%;
}

.field-name-field-event-image {
margin-top: 20px;
}
.getlocations_map_canvas {
max-width: 100%;
}

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 121

LJDrupalSupplement.indd 121 9/15/12 9:58 AM


INDEPTH

Figure 10. The Final Themed Layout for the Event Content Type

Theres so much more you can editor to the Overview Text area. If
do with custom content types and you want to get more hands-on with
theming in Drupal 7; this is just the code, you could dispense with Display
tip of the iceberg. To enhance the Suite and add a node--event.tpl.php
content editor experience, a nice file to your theme folder and theme
addition would be to add a WYSIWYG the Fields individually.

122 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 122 9/15/12 9:58 AM


INDEPTH

Resources
Professional Theme (front-end theme pictured in the demo): http://drupal.org/project/professional_theme

Date: http://drupal.org/project/date

Get Locations: http://drupal.org/project/getlocations

Link: http://drupal.org/project/link

Geocoder: http://drupal.org/project/geocoder

geoPHP: http://drupal.org/project/geophp

Display Suite: http://drupal.org/project/ds

Libraries API: http://drupal.org/project/libraries

Get Locations Documentation:


http://drupalcode.org/project/getlocations.git/blob/refs/heads/7.x-1.x:/README.txt

Installing Drupal 7: http://drupal.org/documentation/install

Installation Tutorial Video: http://learnbythedrop.com/drop/173

Sign in/Create a Free Google Account: https://code.google.com/apis/console

Google Maps API Key (v.3.0):


https://developers.google.com/maps/documentation/javascript/tutorial#api_key

Drupal Is Not a CMS: http://www.palantir.net/blog/drupal-not-cms

Danny Englander is a Drupal Developer specializing in theming,


site building, UX, UI, responsive design and JQuery. He runs his
own Drupal shop and freelances for various clients around the
United States. He has a real passion for Drupal and likes getting
involved with the Drupal community and on drupal.org to help out
in the issue queue and forums. He recently contributed his first
module to drupal.org, and also started designing and developing
a contrib theme. Danny lives in San Diego, California, with his
wife Elise, and together they love traveling and exploring. He is an
avid photographer and recently designed and developed a new
photography Web site, http://highrockphoto.com, built with Drupal,
of course. For more information, see http://highrockmedia.com or
http://twitter.com/highrockmedia.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 123

LJDrupalSupplement.indd 123 9/15/12 9:58 AM


INDEPTH

Tips for
Writing
Interoperable
Drupal
Distributions
Want a crash course on how to write distributions for the
Drupal platform? Get tips and expert advice from a longtime
Drupal contributor and distribution developer. This article is
packed with examples of problems and solutions for writing
plugins that integrate cleanly with other distributions and
make the best use of the Drupal toolkit.
NEDJO ROGERS

First off, what is a distribution and why potter. But, if its your first time spinning
would you write one? Even more than clay, your plates likely to come out
many other content management system wonky or crack when it hits the kiln.
(CMS) frameworks, Drupal is up for What you want is a moldsomething
pretty much any task you set it. You can thatll give your plate just the right
think of Drupal like a potters workshop. thickness and structure and shape. From
Want a vase or plate or mug or there, sure, you can add your own details
Halloween mask? You can find different and dab on whatever glaze you like.
kinds of clay on the shelf and the potters So if Drupal is like a potters workshop,
wheel is right over therego for it! a distribution is the plaster mold
No problemas long as youre a skilled something you can use quickly to make

124 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 124 9/15/12 9:58 AM


INDEPTH

an expertly designed product that fits a the existing projects. Thats what open
particular purpose. source is all about.
Theres a growing set of Drupal W ith the why nots out of the way,
distributions available. Need to build a here are some key reasons to consider
Web site for a conference, newspaper, writing a distribution:
government agency, on-line store or
nonprofit organization? Rather than n Youre working with or for a large
starting from scratch, youll get a huge institution or network that will
leg up if you start with the Conference need many sites built along a
Organizing Distribution (COD), common model.
OpenPublic, OpenPublish, Commerce
Kickstart or Open Outreach. n Youve got a sizable contract to
build a Web site that fits a need
Why Write a Distribution? not already covered by an existing
Maybe the first question should distribution; you expect to be doing
be, what are some top reasons similar sites in the future, and
not to write a distribution? Fame youve got room in the project
and fortune, for onewriting and to generalize.
maintaining a distro is hard work. It
eventually may create some income n Youre tired of doing the same
in the form of contracts to extend site-building work over and over
existing functionality, but in the short and want to focus on refinements.
term, youve got a ton of designing
and coding to get through. As for n You have a burning interest in and
fame, well, despite their merits, most commitment to a particular sector
distributions are notably modest in or need and want to dig in over the
terms of both community profile and long term.
the number of actual installs.
Another good reason not to write n Youre committed to lowering the
a distribution is there already may be financial and technical barriers to
one (or more) in existence that fits the technology access.
bill. True, those existing distributions
may not do everything you want them n Youre up for sharing your work,
to do exactly the way you would have even though doing so will feel
done it. But, rather than doing it your like pinning a badge to your chest
own way, try pitching in and improving labeled complaints department.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 125

LJDrupalSupplement.indd 125 9/15/12 9:58 AM


INDEPTH

n Youre an open-source evangelist installed. Each distribution needs its


and deeply believe that everyone is own install profile.
best served when technology is freely
available to all. n A feature module or feature is a
Drupal module produced with the
Key Concepts in Distribution Features module and containing
Authoring exported configuration. A distribution
Before I go into details, heres a quick typically is made up of multiple
terminology overview: feature modules, each providing a
distinct set of functionality.
n A module is a plugin that extends
Drupals functionality. The core n The features approach is built
Drupal product, Drupal core, ships on exportablesAPIs that allow
with a number of modules, and configuration from a Drupal site to
community contributors have written be exported into code and reused
thousands more. on other sites.

n An install profile is a special kind of n An exportable configuration object,


Drupal module that contains code often called a feature component,
to be used only when the site is first is uniquely identified by a machine-

Some Additional Vocabulary


n A dependency is created when one module requires another in order to function.
A dependency can be hard (when module A wont even install if module B
isnt present) or soft (when module A will install but wont be fully functional
without module B). Dependencies are an important consideration in distribution
authoring because they can lead to incompatibilities between one set of
features and another.

n A patch is a text file containing a suggested code-level change to an existing


piece of code, like a module or Drupal core.

n A theme is the set of templates that gives a site its particular look and feel.

126 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 126 9/15/12 9:58 AM


INDEPTH

readable name or (less frequently) a Drupal distribution developers. But in


universally unique identifier (UUID). using it, they hit a number of snags.
Written on a one-off basis, each
n One or more features and their distribution had its own particular logic
supporting dependencies can be and structure. If you wanted to extend
packaged together into an app that Open Atrium, you had to wade in and
then can be installed with the Apps learn a lot about how that distribution
module. Many but not all Drupal was put together. And if you loved a
distributions are being built using particular piece of Open Atrium (say,
the apps model. its event calendar) and wanted to pull
just that feature into your own site
n A base distribution is a distribution well, good luck. Each feature was
thats specifically written to provide highly dependent on a whole set of
commonly needed functionality for assumptions and dependencies specific
use in other distributions. to the distribution.
Disentangling the Web looked like
Distributions and Interoperability way more work than it was worth.
Interoperability is the ability of different Kit The Open Atrium devs quickly
systems to work together. When we recognized these issues and dug into
talk about interoperability and Drupal addressing them. The result was Kit, a
distributions we mean: how can we specification for feature development.
make sure the building blocks of The Kit Feature Specification sets out
different distributions fit together in guidelines that feature developers can
consistent and understandable ways? follow to help ensure that different
The Origin of Features Much of features integrate seamlessly together,
the toolset for building distributions no matter what distribution or purpose
began with Open Atrium, a Drupal they were built for.
distribution that provides an advanced, Whats in Kit? The good news is
team-based project management mainly some pretty sensible and easy-
solution. Open Atrium devs took the to-follow naming conventions. Kit
time to build out a framework useful answers questions like: how should
not just for their own product but you name the paths to your main
for any distribution. The result was feature landing pages? By following
the Features module and a host of Kit, youll help ensure that, if your
supporting add-ons. work is combined with other Kit-
Features quickly caught on with compliant features, the result wont be

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 127

LJDrupalSupplement.indd 127 9/15/12 9:58 AM


INDEPTH

Why Build Interoperable Features,


Apps and Distributions?
Youre already taking considerable time and effort to build a distribution. Why put
in the extra work to make it interoperable?

n Youll be able to integrate other features or apps. Theres no need to go it alone.


By building your distribution with interoperability foremost in mind, youll be
able to add in what others already have produced and be able to focus on just
the key pieces that interest you.

n More distros and sites will be able to use your work. Its frustrating to build
something and then watch someone else reproduce pretty much exactly what
you already did only with a few details changed. If you make it easy to do so,
others will be more likely to use, and maybe even contribute back to, what
youve begun.

a mishmash of disparate configuration. sense, dont worryitll all be a lot


But, theres a lot that didnt make clearer after you roll up your sleeves
it into Kit. Here are some practical and dig in a bit. And if code blocks
steps beyond Kit to help ensure that make your eyes swim, just pretend they
your work integrates seamlessly with arent thereyou can do a lot without
other distributions. touching a line of code.
Study Up on Existing Distributions
Practical Steps in Building A first good step is to get up close and
Interoperable Distributions comfortable with some of the existing
So far, Ive been describing distribution distributions. You might choose to
building in pretty general terms. Now build your features on the same model
its time to jump into some practical as those of an existing distribution or
problems and real-world examples. feature set, or even directly add to an
If youre a developer relatively new existing feature set.
to Drupal and some of this doesnt For example, the Debut feature set
immediately make a lot of intrinsic includes a Debut Feature Specification

128 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 128 9/15/12 9:58 AM


INDEPTH

that extends and updates Kit, providing her comments in a recent thread on
guidelines for a higher level of integration. drupal.org. Her concerns, to paraphrase,
The Debut project page on drupal.org were that the apps model clouds
also links to developer documentation waters already muddied by features and
on building new Debut features. modules and whatnot and also detracts
Other distributions like OpenPublish from getting usability fixes into Drupal
include detailed documentation on core and drupal.org where they can
their Web sites about how to write help everybody.
features or apps that extend the That said, well, Apps is being
distribution. Read up! adopted as a tool in many Drupal 7
Consider Building Off a Base distributions and can help solve both
Distribution Panopoly is the first development and usability issues.
distribution written specifically to For developers, Apps makes it easier
be a base for other more-specific to incorporate features from other
distributions. Panopoly tackles some distros into their own. For example,
key administrative, usability and design Apps is what facilitates using Panopoly
challenges that any distros will face. as the basis of your own distribution.
Building a distribution off Panopoly For site builders, Apps gives a one-
will save you having to solve all those click solution for installing a feature
problems yourself. It also will facilitate complete with all of its dependencies
interoperabilityat least with other on a site that wasnt based on a
Panopoly-based distros. The Panopoly distribution.
project page on drupal.org includes Dont Re-invent the Feature
documentation on how to base a Even beyond building off a base
distribution off of Panopoly. distribution, you may be able just to
Spark is a newer initiative thats take and use a lot of what you need
also tackling usability and design from existing features. Before writing
challenges. Its not yet fully primed to yet another event or blog or mapping
be a base for building other distros, or social-media feature, take a good
but discussions are underway, and its look at whats already out there.
a project to keep an eye on. Seriously ask yourself: what would
Consider Packaging Your Work I need to do to use the existing
as Apps Not everyone is thrilled with feature directly in my distribution?
the Apps model. Apps makes respected Incorporating other peoples work can
Drupal developer and evangelist Angie free you up to focus on what youre
Byron (webchick) wincejudging by really interested in. Think of it this way:

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 129

LJDrupalSupplement.indd 129 9/15/12 9:58 AM


INDEPTH

the alternative is having to build and features, consider having each of your
maintain everything yourself. Ouch! feature modules create the general-
And, what better path to use roles it needs at install time using
compatibility could there be than regular Drupal APIs. Heres an example
actually using the same code? of how you might do this in a modules
Avoid Dependencies of One install file using hook_install(), which
Feature on Another No, really, Drupal core calls when a module is
avoid themeven soft dependencies. first installed:
Unless your new feature is strictly
enhancing an existing featurelike, /**

say, an Event registration feature that * Implements hook_install().

enhances an existing Event feature *

having dependencies on other features * Create "administrator" and "editor" user roles

is trouble. * if they don't already exist.

The key problem with dependencies */

is that they quickly produce function example_install() {

incompatibilities between one set of $role_names = array('administrator', 'editor');

features and another. The Features foreach ($role_names as $name) {

module wont let you enable two // If there isn't an existing role by this

different features that have one or // name, create one.

more identically named components if (!$role = user_role_load_by_name($name)) {

of the same type. You can avoid $role = new StdClass();

dependencies through careful $role->name = $name;

planning of how youll handle the user_role_save($role);

components that are needed in more }

than one feature. }

Keep Generic Components }

Out of Features Exportables


Take, for example, a user role like And, even before you write your own
administrator or editor. These are custom install hooks, have a look at
generic componentstheyre going to the Apps compatible module, which
be needed in many different features, provides built-in support for handling
so that each feature can assign shared components like user roles and
appropriate permissions for tasks like taxonomy vocabularies.
creating a particular type of content. Enhance Other Features without
Instead of exporting user roles to Requiring Them Say youre writing a

130 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 130 9/15/12 9:58 AM


INDEPTH

feature that adds social-networking $features = array_intersect_key(

links to different content types. Great $features,

but which content types should get drupal_map_assoc($modules)

the links? );

If you hard-code content types from


specific features into your social linking // Iterate through the features.

feature, youve introduced either soft foreach ($features as $feature) {

or hard dependenciesand precluded // Look at the $feature->info array for node

other feature authors from using the // types and an 'example_social_types' key.

same approach. Instead, you can build // Add any hits to the $social_types array.

in a flexible responder that enables other }

features to register their content types for if (!empty($social_types)) {

social linking easily. Heres an example. // Merge into the existing variable's value so

Say youre building a feature that // as not to overwrite existing settings, using

uses the Service links module, which // variable_get(), array_merge(), and then

stores configuration in a variable called // variable_set().

service_links_node_types. In your }

feature, include implementations of }

two Drupal code hooks that allow you


to respond when modules are enabled. /**

Heres some pseudo code; see the Debut * Implements hook_enable().

Social feature for a full working example: *

* When this module is enabled, process any social

/** * linking designations for all currently enabled

* Implements hook_modules_enabled(). * modules.

* */

* When a module is enabled, check to see if it is function example_enable() {

* a feature module with a node type designated for example_modules_installed(module_list());

* social linking. }

*/

function example_modules_enabled($modules) { Now, to get its content type


$social_types = array(); recognized for social linking, a
feature will need only a single line
// Load info from feature modules and filter to in its .info file:
// get only the ones that were just installed.

$features = features_get_features(); example_social_types[example_node_type] = example_node_type

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 131

LJDrupalSupplement.indd 131 9/15/12 9:58 AM


INDEPTH

Distinguish between Hard distros, each with their myriad advocates.


and Soft Configuration Features The Context module enables finely
provide reliable and consistent methods tuned control over block placement on
for capturing, reproducing and updating any site page or section into any region
configuration. Thats exactly what you that the sites theme provides.
want with whats sometimes called The Panels module enables even more
hard configuration: the settings and options for selecting what content to
objects that are core to your feature place, but places content into its own
or distribution and shouldnt change custom layouts and regions instead of
in different environmentsstuff like those provided by the sites theme.
content types and fields. If Context was the early champion,
But theres also soft configuration the balance may be shifting to Panels,
the stuff you might want to set initially which appears to be closer to the layout
but that site administrators can and solutions that will go into Drupal 8 core.
should change on each site. Soft The Drupal Commons distro, for example,

One of the biggest divides between one


distribution and another is layouthow are
blocks of content arranged on the page?
configuration includes things like the is switching from Context to Panels with
default theme used on the site. You want its Drupal 7 upgrade.
to set an initial default theme, but any One approach thats used is to pull
site should be free to replace that with layout and other user interface stuff
its own theme choice. into a separate feature. That way, site
To set soft configuration, you can skip builders or distro authors can choose to
Features and instead use the regular use the core of a feature even if they
Drupal API functions like theme_enable() choose a different layout solution. Its an
and variable_set(). interesting idea but one that adds some
Choose Your Layout Solution extra layers of complexity to the feature-
and Stick with It One of the biggest building process.
divides between one distribution and Which to choose is going to be is up
another is layouthow are blocks of to you. But the layout model you decide
content arranged on the page? Here, on will have a big impact on how your
there are two main options used in feature or distro fits with the crowd.

132 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 132 9/15/12 9:58 AM


INDEPTH

Keep It Stable, Proven and Lean the event calendar.


Theres a place for trying out the latest But sticking terms that are specific
experimental alpha release of a cool to the nonprofit organization use case
module that someone posted last week, directly into Debut Event would break
but its probably not in your distro. the whole idea of a generic feature.
Stick wherever you can with the tried- So instead we put just that bit of
and-true solutions that any skilled and enhancement into the Open Outreach
experienced developer would choose install profile, using one of the many code
for the purpose. Use recommended, hooks that Drupal provides for responding
stable releases rather than development to data transactions on the site. Heres
versions. If you dont absolutely have to code adapted from openoutreach.profile:
add a new dependency, dont. And avoid
patches like the plague; theyre bound /**

to break if a site already has installed a * Implements hook_modules_installed().

non-patched version of the code. *

Yes, there are exceptions to all of * Add custom taxonomy terms to the event_type

these rules. You might, on rare occasion, * vocabulary if it is created.

see no choice but to use a development */

version of a module or judiciously add a function example_entity_insert($entity, $type) {

patch to address a critical bug. But every if ($type == 'taxonomy_vocabulary' &&

time you do, keep in mind youre cutting $entity->machine_name == 'event_type') {

yourself off from other distros or features $names = array(

that might not have climbed out on the 'Conference',

limb youre clinging to. 'Meeting',

Save the Truly Specific for Your 'Workshop'

Install Profile Heres an example from the );

Open Outreach distribution. Open Outreach foreach ($names as $name) {

is built for nonprofit organizations, but $term = new StdClass();

its based on Debut features, which are $term->name = $name;

written to be generic enough to be used $term->vid = $entity->vid;

on many different types of sites. $term->vocabulary_machine_name =

One such feature is for event handling. $entity->machine_name;

Debut Event includes an Event type taxonomy_term_save($term);

vocabulary that allows content editors to }

classify events by category, with events of }

each category getting a different color on }

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 133

LJDrupalSupplement.indd 133 9/15/12 9:58 AM


INDEPTH

When the event type vocabulary is initiatives, each focused on a distinct


created, Open Outreach responds by adding area of development and headed up by
a few initial event types that nonprofit leaders in the field.
organizations typically might use. The Debut Probably the most sweeping Drupal
Event feature doesnt have to know or care. 8 changes for distributions are coming
out of the configuration management
Distributions and Interoperability initiative (CMI). This initiative has
in Drupal 8 given Drupal native support for
Version 8 of Drupal core is being file-based configuration. A lot of the
developed through a series of workarounds that are necessary to

Resources
Tools for Working with Distributions:
Apps Module: http://drupal.org/project/apps

Apps Compatible Module: http://drupal.org/project/apps_compatible

Debut Feature Specification: http://drupal.org/project/debut

Entity API Module: http://drupal.org/project/entity

Features Module: http://drupal.org/project/features

Kit Feature Specification: http://drupal.org/project/kit

Distributions Hosted on Drupal.org: http://drupal.org/project/distributions

Drupal 8 Configuration Management Initiative:


http://groups.drupal.org/build-systems-change-management/cmi

Selected Drupal Distributions:


Commerce Kickstart: http://drupal.org/project/commerce_kickstart

Conference Organizing Distribution (COD): http://drupal.org/project/cod

Drupal Commons: http://drupal.org/project/commons

Open Atrium: http://openatrium.com

Open Outreach: http://drupal.org/project/openoutreach

OpenPublic: http://drupal.org/project/openpublic

OpenPublish: http://drupal.org/project/openpublish

Panopoly: http://drupal.org/project/panopoly

Spark: http://drupal.org/project/spark

134 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 134 9/15/12 9:58 AM


INDEPTH

convince Drupal to recognize code- Draw on the best of whats out there.
based configuration in Drupal 7 may And, in turn, make your feature, app
soon be a thing of the past. or distribution as interoperable as it
Big changes of course bring their can be. Doing so will help others make
share of challenges. Theres a lot that the most of your contribution and also
still needs to settle out before itll help future-proof your work, whatever
be clear just how features, apps and Drupal 8 brings.
distributions will translate to Drupal
8. But with core Drupal devs solidly Nedjo Rogers has been an active Drupal contributor
addressing configuration management since he posted his first module in 2003. He is the
in Drupal core, the future of Drupal technical lead of the Open Outreach Drupal distribution
distributions looks bright. for nonprofit organizations and a partner at Chocolate
In the meantime, if youre venturing Lily Web Projects, http://chocolatelilyweb.ca. When not
into the world of apps or features or coding, he writes poetry and folk songs and tries to
distros, take the time to do it right. learn the accordion.

Read
LINUX JOURNAL
on your
Android device
Download the app
now in the
Android
Marketplace.

www.linuxjournal.com/android
For more information about advertising opportunities within Linux Journal iPhone, iPad and
Android apps, contact Rebecca Cassity at +1-713-344-1956 x2 or ads@linuxjournal.com.

LJDrupalSupplement.indd 135 9/19/12 10:38 AM


INDEPTH

Cache in Drupal 7
Drupal is a powerful and very flexible, but often heavy,
platform. In this article, I show how to utilize all of its
advantages and still make it perform fast.
JANEZ UREVC

Performance is one of the most some of its contrib modules provide


important factors that should be mechanisms that are powerful and
considered when building Web sites. flexible enough to build sites of this
Users expect sites to be good-looking, size successfully. I describe some of
feature-rich, loaded with multimedia them here.
and interactive. To achieve all these The solutions and techniques discussed
things, you often need to build heavy in this article were tested while building
Web applications, which are not always a relatively large media site, which was
performant by their nature. To achieve migrated to Drupal 7 in December 2012.
the best balance between features It currently is the biggest Drupal site in
and performance, there are various the wider Balkan region.
techniques to use, and caching is one
of the most popular. What Is Cache?
It is relatively simple to build a small Cache is a frequently used technique
personal Web site or blog that will in computing, for both hardware and
perform well. Like most other Web software. The basic idea behind cache
platforms, Drupal also provides built- is to identify data that is used often
in mechanisms that will allow you to and store it on a medium where it
achieve sufficient performance for can be fetched as quickly as possible.
such a site in a relatively simple way. When building Web applications, you
However, things become much more usually want to load as much data as
interesting when you have to build possible from memory (which is fast).
a site with a few hundred-thousand On the other hand, you mostly need
content items and tens of millions permanent storage for it. Since RAM is
of visits per month. The solution not such a medium, you have to keep
definitely will not be straightforward, the data on disk, which is very slow
but it can be done. Drupal and in most cases. This leads to a typical

136 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 136 9/15/12 9:58 AM


INDEPTH

architecture for Web applications that time the same query is executed.
uses disk to store data permanently Substantial savings can be achieved
and RAM as an efficient cache medium this way, because repeating queries
for the most-used pieces of it. happens a lot in Web apps.
There are many cases when you
usually will want to use cache in Web Cache in Drupal 7
development, including the following: Cache is implemented as a very flexible
and pluggable framework in Drupal 7.
n Heavy database queries. Here are three of the most important
concepts to understand:
n Output that is expensive to render.
n A cache item is a complete piece
n Complex numerical calculations. of data that is stored in cache. A
developer addresses each cache
n Code with substantial use of I/O item with a key that obviously
(disk). should be unique.

n Data that was fetched from n Cache bin is a group of similar


remote servers. cache items. There are a lot of
different cache bins, as Drupal
Two caches should be considered allows its modules to create their
by every PHP+MySQL developer: own. Each cache item generally
can be saved to any bin available
n APC (Alternative PHP Cache) is a PHP in the system.
extension that implements op-code
cache. Op-code cache saves overhead n Cache back end is a technology
that is caused by the fact that PHP platform that is used to store cache.
compiles its scripts on every request. Each cache bin generally can be
Because most of the scripts dont stored in a different back end. There
change often, APC saves time by is support for numerous back ends
saving compiled versions of scripts in Drupals contrib ecosystem (such
into shared memory to be available for as APC, Memcached, Redis and so
the next requests. on). It is not hard to implement
support for a new back end if your
n MySQL query cache saves query project requires something that has
results to be available the next not been supported yet.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 137

LJDrupalSupplement.indd 137 9/15/12 9:58 AM


INDEPTH

If you develop a Drupal module and n cache_field storage for cached


you want to utilize the advantages of versions of Drupals fields.
Drupals cache framework, you should do
something like this: n cache_filter bin for the Filter
module to store already filtered pieces
<?php of text.
if ($cache = cache_get('my_cache_item', 'cache')) {

$data = $cache->data; n cache_form bin for the form system


} to store recently built forms and their
else { storage data to be used in subsequent
// some heavy calculations... page requests.

cache_set('my_cache_item', $data, 'cache'); n cache_image bin used to


} store information about image
manipulations that are in progress.
// Use $data

?> n cache_menu storage for the menu


system to store router information and
The cache item in the above snippet menu link trees.
is keyed with my_cache_item and
stored in a bin called cache , which is n cache_page bin used to store
obviously Drupals default bin. Check compressed pages for anonymous users.
Drupals cache_set() (http://dgo.to/a/
cache_set) and cache_get() n cache_path bin for path alias
(http://dgo.to/a/cache_get) functions lookup.
if you need more information.
The following is a list of cache bins n cache_update bin for the Update
provided by Drupal core: module to store information about
available releases, fetched from the
n cache default (generic) cache bin. central server.

n cache_block storage for cached Cache Back Ends


versions of built (rendered) blocks. A lot of different cache back ends
can be used together with Drupal.
n cache_bootstrap bin for data I describe some of the most popular
required to bootstrap Drupal. ones here that also have support in at

138 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 138 9/15/12 9:58 AM


INDEPTH

least one Drupal module. Back ends improvement, as PHP files generally
that are most commonly used in the do not change much. It is relatively
Drupal ecosystem also are very popular simple to install and very easy to
in general Web development. Each configure. It should be used on every
of them has its own advantages and Web server that runs PHP (production
disadvantages, and each will satisfy and development).
different needs. Another feature of APC that people
Some modules implement more are not always aware of is the user
than just cache support. They often cache. The user cache uses APCs shared
implement sessions and semaphore memory to store users (developers)
(locking) handlers too. That also will custom data, and it definitely can be
speed up your site, as a typical Drupal used for cache purposes. It is very fast,
Web site uses those mechanisms because it stores data directly in PHPs
frequently. Refer to each modules memory. Assuming that you already
project page and README.txt file in have APC installed on your server
order to utilize their advantages. (and you should), it also does not add
further complexity to the server stack.
Database Cache (Default) Data in APC is not stored permanently;
Drupals default cache implementation is you will lose all your data if the power
obviously very easy to use, as you get it goes down. Another disadvantage
for free when you install Drupal. It also is the fact that each server maintains
doesnt add any additional complexity its own version of cache. This will
to your server stack, because it uses a cause cache warm-up to take longer
database (usually MySQL). This back end in high-availability (more Web
should work totally fine for most smaller servers) setups. This also can lead to
sites. The problem is its speed, because synchronization problems.
it writes all data directly to disk. Writes
are especially very slow, as MySQLs query Memcached
cache helps to boost read performance. Memcached is an open-source, high-
Another disadvantage is the fact that it performance, distributed memory object
uses a database that already is under very caching system (http://memcached.org).
heavy load on high-traffic Web sites. It is very popular and is used on many
well-known sites. It runs as a separate
APC User Cache dmon, which means that it adds another
I already mentioned APC (http://drupal.org/ level of complexity to the server stack. It is
project/apc). It provides a lot of performance very easy to configure and administer, so

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 139

LJDrupalSupplement.indd 139 9/15/12 9:58 AM


LJDrupalSupplement.indd 140 9/15/12 9:58 AM
LJDrupalSupplement.indd 141 9/15/12 9:59 AM
INDEPTH

that shouldnt be a problem. Applications later writes it to disk, which makes it


communicate with it via the network (TCP permanent. Write frequency can be
or UDP). You will have to install another configured, which gives you the power
PHP extension in order to use it with PHP to balance between performance and
applications. It stores all data in memory, security of your data. It needs a PHP
which makes the data non-permanent. All extension, just as Memcached does. It
Web servers will use the same Memcached also comes with a PHP library. Redis is
pool in high-availability environments, very fast, but sooner or later it will need
which is another big advantage. See access to I/O, which could cause some
http://drupal.org/project/memcache performance overhead in environments
for more information. that already are under heavy load. See
also http://drupal.org/project/redis.
Redis
Redis is an open-source, advanced key- MongoDB
value store (http://redis.io). It is very MongoDB is a scalable, high-
similar to Memcached. It is fast, centralized performance, open-source NoSQL
and relatively easy to configure. It stores (document-oriented) database
your data in memory, but it sooner or (http://www.mongodb.org). It

Figure 1. This performance overview of all the back ends described in this article
shows that APC is the fastest and MySQL (DB) the slowest. Redis and Memcached are
relatively similar when it comes to performance, but that could change if Redis would
write its data to disk often. MongoDB is very fast, especially when it comes to writes.

142 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 142 9/15/12 9:59 AM


INDEPTH

is much faster than MySQL, and it The paths in the above example should
stores data permanently. You will need be adjusted to your specific installation.
to install a PHP extension in order to When you include cache back ends, you
use it. It is probably the most complex need to set the default:
to configure and administer of all the
back ends I describe here. MongoDBs $conf['cache_default_class'] = 'MemCacheDrupal';

other advantage is its ability to store //$conf['cache_default_class'] = 'Redis_Cache';

Drupals content, which makes for a //$conf['cache_default_class'] = 'DrupalAPCCache';

really powerful content database in //$conf['cache_default_class'] = 'DrupalMongoDBCache';

addition to a powerful cache back end. //$conf['cache_default_class'] = 'DrupalDatabaseCache';

How to Configure Cache In the above example, Memcached


Back Ends is configured as a default cache back
You will need to do some configuration end. The appropriate line should be
in Drupals settings.php in order to uncommented in order to select a
use different cache back ends. First, different option. Besides the default back
you need to include cache back-end end, where all bins will go, you also can
implementations: define per-bin back ends:

# Memcache // cache_form bin

include_once('./includes/cache.inc'); $conf['cache_cache_form'] = 'Redis_Cache';

include_once('./sites/all/modules/memcache/memcache.inc');

$conf['memcache_key_prefix'] = 'drupal'; // cache_menu bin

$conf['cache_cache_menu'] = 'DrupalMongoDBCache';

# Redis

$conf['cache_backends'][] = // etc....

'sites/all/modules/redis/redis.autoload.inc';

$conf['redis_client_interface'] = 'PhpRedis'; //Library or extension In the above example, the bin


cache_form is configured to go into
# APC Redis, and the bin cache_menu is set
$conf['cache_backends'][] = to be stored in MongoDB.
'sites/all/modules/apc/drupal_apc_cache.inc';

Cache Implementations in Drupal


# Mongo Drupal core and some of its modules
$conf['cache_backends'][] = utilize the cache framework to implement
'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc'; user-friendly, easy-to-configure caching.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 143

LJDrupalSupplement.indd 143 9/15/12 9:59 AM


INDEPTH

Page and Block Cache save HTML output of Drupal blocks (parts
Page and block cache are implemented of a page). Blocks also can be cached
in Drupal core, and youll get them with for registered users, which will give you
every Drupal installation. Page cache will some performance improvement for
save the HTML output of the entire page non-anonymous traffic. Blocks are stored
for anonymous users and store it to the in the cache_block bin.
cache_page bin. This HTML will be Both are very easy to enable and
displayed to all anonymous users, which configure by navigating to admin/config/
will bypass most of the Drupal bootstrap devel/performance.
and the entire page-generation process.
This will save a huge amount of time and Views Cache
server resources. Views is the most frequently used Drupal
Block cache, on the other hand, will module (http://drupal.org/project/
views). It provides a flexible method for
Drupal site designers to control how lists
and tables of content, users, taxonomy
terms and other data are presented. There
probably arent many serious Drupal Web
sites that dont use this module.
Views implement a cache mechanism
that will save the result of a views query
and its HTML output. Views will operate
with its cache on a timely basis, but
you can implement your own plugin to
achieve totally customized behavior. The

Figure 2. Configuration for Page and


Block Cache Figure 3. Configuration for the Views Cache

144 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 144 9/15/12 9:59 AM


INDEPTH

views cache can be configured per every


view, which gives you a lot of flexibility.
Cache items will be stored in the
views_cache_data bin.
Usage of the views cache should be
considered as an option on every Drupal
Web site that uses the Views module.

Panels Cache
Panels is another powerful Drupal module
(http://drupal.org/project/panels).
It allows you to build complex page
layouts and configure and control them
in a really intuitive way. Besides its many
other features, it also has a powerful
cache implementation. Panels, by default, Figure 4. Configuration for the Panels Cache

Did you find this


special edition informative?
Are you interested in
receiving information
on future Linux Journal
Special Editions?

SIGN UP NOW to be included at no cost:


http ://www.linu xjou r na l. c o m/ s pe c ia lis s ue

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 145

LJDrupalSupplement.indd 145 9/15/12 9:59 AM


INDEPTH

Figure 5.
Configuration of
Devels Query
Cache

will allow you to cache almost everything but it wont help you much if you dont
and configure granulation and lifetime. optimize your queries and code first.
Again, this can be completely customized Cache will just save you from running
with your own custom plugins, resulting them over and over again, but you still
in even more flexibility. will have to execute your slow queries
The panels cache is configured on the and run your slow code from time to
configuration page for each panel. It is time. However, Drupal provides a lot of
usually configured on a per-pane (part of tools to optimize those things too.
a page) basis. The Devel module (http://drupal.org/
project/devel) implements a handy query
How to Optimize Your Drupal log, which will print the list of all queries
Page for Performance that were executed during a given request
Cache is a very powerful tool in Drupal, in the footer of your page. This allows

146 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 146 9/15/12 9:59 AM


INDEPTH

Figure 6. Example of a Displayed Query Log (with Slow Queries)

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 147

LJDrupalSupplement.indd 147 9/15/12 9:59 AM


INDEPTH

Figure 7.
XHProf
Profiler

you to identify slow database queries at the bottom of the page.


and optimize them. Doing some minor Once you have optimized your code, you
modifications of a query (view) or an index can start using cache. Identify parts of the page
on a table will help you a lot in most cases. that are candidates for caching. When you
Another handy tool is the profiler have cached all parts of the page, enable
(http://en.wikipedia.org/wiki/ page cache or use a reverse proxy. Reverse
Profiling_(computer_programming)). proxy does a similar job as a page cache,
It will allow you to identify parts of but it is a separate dmon that sits in front
your code that are slow or that use an of the Web server and is heavily optimized
abnormal amount of memory. When for this job. The most popular reverse
it comes to PHP, I recommend XHProf proxy in the Drupal community is Varnish
(https://github.com/facebook/xhprof), (https://www.varnish-cache.org), which
which is really easy to use. Once you also has a contrib module that integrates it
install and configure it, the Devel module with Drupal (http://drupal.org/project/
gives you Drupal integration for it. You varnish). Another module that does a
just have to enable it, and Devel will run similar job is Boost (http://drupal.org/
it automatically on every request and project/boost). Boost will save the HTML
display a link to the profiling information output of entire pages to ordinary HTML

148 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 148 9/15/12 9:59 AM


files, allowing the Web server to serve static LINUX JOURNAL
files for anonymous users.
on your
Conclusion
Drupal has been known as a relatively
slow platform, which is somewhat
e-Reader
true. But, it also is very flexible and
provides a lot of room for performance
optimizations. This could make it
even faster than its better-optimized
alternatives in the end, while still
preserving its strength and flexibility.
The performance optimization tools
that come with Drupal core definitely
will work for small and medium Web
sites. When you start dealing with e-Reader
larger Web sites, youll need to know editions
your requirements and needs and use
a more customized approach. You will, FREE
for Subscribers
however, find a lot of tools and best
practices even for large projects, which
makes Drupal an excellent platform for
almost every type of Web project.

Janez Urevc is a Drupal developer from Slovenia, EU. He really


loves the things he does, and thats why he feels that every day
is the best day of his life. Hes been dedicated to open source
since high school. He graduated in Software Development from Customized
the Computer and Information Sciences department at the
University of Ljubljana. His Bachelors thesis was focused on Kindle and Nook
the implementation of Agile principles and Scrum methodology
in a Web development department of a large media company.
editions
Besides Drupal, hes also passionate about almost everything now available
connected to the Web, open source, Linux and software
development. He participated in the 2011 Google Summer of
Code, where he worked on the Media derivatives API for Drupal.
LEARN MORE
LJDrupalSupplement.indd 149 9/15/12 9:59 AM
INDEPTH

USENIX.org:
a Case Study
of a Migration
to Drupal
The new USENIX.org is built on Drupal with an extensive
Salesforce.com integration, Apache Solr-based faceted searching,
e-commerce from the Drupal Commerce suite and microsites
built with Organic Groups. Dozens of custom Drupal modules
make this powerful system simple for staff and visitors.
JODY HAMILTON

USENIX (http://usenix.org), the of custom HTML pages with a slew of


Advanced Computing Systems Perl scripts and no database. The lack
Association, was founded in 1975 of a database-driven system meant it
to foster and promote technical was never possible for the USENIX site
excellence and innovation among to have much structural organization
system administrators and other .nix or coherenceit had simply grown
professionals. This member-focused organically for decadesand it created a
organization runs dozens of conferences management nightmare for those tasked
each year, publishing content on-line with maintaining this growing library of
for each event. Prior to the migration content and functionality.
to Drupal, most conferences and Web When we began the project, USENIX
pages were created using either straight knew it needed a robust Content
HTML or PERL, and after 17 years of Management System (CMS) and had
working with its Web properties in this chosen Drupal. The new USENIX Web site
way, USENIX had tens of thousands requirements included:

150 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 150 9/15/12 9:59 AM


INDEPTH

Figure 1. The New USENIX.org

n Replacement of the old HTML and adopted Customer Relationship


PERL script functionality. Management system and its Event
Management system (Salesforce.com
n Strong security. and CVent, respectively).

n Robust user and role management. n E-commerce functionality.

n Seamless integration with its newly n Video integration.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 151

LJDrupalSupplement.indd 151 9/15/12 9:59 AM


INDEPTH

n Private and public files. 12 custom features, numerous contributed


modules and our custom themes. Beyond
n Faceted search listings. these upgrades, being an early adopter
meant that our developers had to commit
n Migration of the data stored in the dozens of additional patches to fix bugs
HTML pages to the new system. and issues with upgrade paths from Drupal
6 to 7. During this process, we repeatedly
Security, e-commerce, user/role fine-tuned our four-hour upgrade bash
management and faceted search were script, which consisted mainly of drush
among the features best matching (the excellent Drupal shell interface)
Drupals strengths. USENIX also is commands. In addition, we rebuilt the
interested in supporting open-source Web sites e-commerce functionality using
software communities, and wanted to Drupal Commerce, ported Houston to
develop its site in a way that gives back Drupal 7, and also re-created numerous
as much as possible. My team at Zivtech views, organic groups configurations,
was chosen for the project due to our profiles and more.
experience with Salesforce.com Drupal Upgrading a complex site to a new major
integrations, Ubercart customizations and version of Drupal is difficult because Drupal
community contributions. core (and to varying extents contributed
modules) provides a migration path for
Building in Drupal 6, Migrating data but no support for legacy code.
to Drupal 7 Often major contributed building blocks
When we started working with USENIX, of Drupal use a new core version as an
Drupal 7 did not have a full release, opportunity for a rewrite, often without an
so the site was built in Drupal 6. We upgrade path. Upgrades are more difficult
used the Ubercart module suite for if they occur sooner after the core release;
e-commerce features and Houston if the site is live (as it typically is); and if
(http://houstoncommand.com) to the site database is updated frequently
handle the integration between Drupal by visitors (purchases, account creation,
and the Salesforce.com CRM, which also comments and so on), and the site cannot
was under active construction. be taken off-line for upgrade. With these
Most of the USENIX Web site already trade-offs in mind, upgrading before site
was complete in Drupal 6 when a decision launch was preferable to postponing.
was made to upgrade to Drupal 7. This was
very early in the Drupal 7 release cycle, so E-commerce
our team had to port 32 custom modules, USENIX sells memberships, file access,

152 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 152 9/15/12 9:59 AM


INDEPTH

physical magazines, books and offprints. To a pleasure to use because it uses the same
cater to these diverse e-commerce needs, entity-based architecture as core Drupal 7.
our team used the Drupal Commerce
framework along with Commerce Coupon, Houston
Commerce Custom Line Items, Commerce USENIX required a complex bi-directional
Devel, Commerce Features, Commerce File, integration between Salesforce.com
Commerce Flat Rate, Commerce Payflo and the new Web site. We used our
Pro and Commerce Shipping to enable the own Houston Command Center
sale, pricing and access to products. (http://houstoncommand.com) over the
Certain files on the Web site are free to more widely used Salesforce Drupal module
select users (depending on membership to allow flexibility with the data model as
status or conference registration) but well as to provide queue management and
unavailable or available for purchase by failover support. Houston is OSS weve
others. Files also can be set to become evolved during several large integration
public at a specified date, so that they projects. It addresses challenges in
are no longer conceptually a product for integrating with SaaS products, including
sale on the site. Multiple product formats handling API limits and downtime. It
for one piece of content are routinely provides a framework for mapping the
sold (such as print and electronic book data model between systems and handles
formats). These needs did not map well queuing and backups.
administratively to the Drupal Commerce Using Houston, we linked authentication,
model of separating the product and its user profiles, membership status, conference
display (the content, aka Drupal node) registration, grant applications, pricebook
and would have made for a complex and entries and e-commerce purchases
tedious workflow for content creation. between the two platforms in a seamless
Fortunately, the Commerce API facilitated manner. Existing USENIX.org members
a solution. Our team was able to hide are able to log in to the new site with the
the creation of products from Web site same credentials they used pre-Drupal
administrators by auto-creating and (which were mainly used in .htaccess-style
updating associated product files, SKUs, authentications) by comparing their
attributes and prices when content is hashed passwords to those migrated into
created and updated. We also used the the CRM. Once authenticated, users can
Commerce API to implement sophisticated manage their membership and profile
membership levels and benefits, including information on the new Drupal site, and
free products per year of membership and USENIX staff can view and edit that data
discount scenarios. The Commerce API was on Salesforce.com or on USENIX.org. When

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 153

LJDrupalSupplement.indd 153 9/15/12 9:59 AM


INDEPTH

users register for a conference on the site, site to grant access to attendee-restricted
their profile information is used to pre- pages and files. Staff even can manage the
populate a registration form on CVent (an prices of different categories of products
SaaS event management system). After sold on the Drupal site (for example,
payment, the CVent registration data is the current price of an audiobook for a
sent to the Salesforce.com CRM, where it USENIX member) from the Salesforce.com
is then available to Houston and the Drupal CRM. By centralizing user history, such as

Figure 2. The Multimedia page is a searchable Solr-based listing of all content


containing video or audio recordings, allowing faceting into specific conferences.

154 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 154 9/15/12 9:59 AM


INDEPTH

conference attendance, membership status, and content (sessions, trainings, information


product purchases and profile information pages) can be a part of a conference. To
in the CRM, the organization can target its create a microsite for a conference in the
outreach and marketing efforts effectively. past, USENIX staff copied a directory of
HTML, CSS and scripts and modified its
Search content and visual style for each conference.
We love using Apache Solr integrated To allow a similar feel of distinct microsites,
with Drupal to build not only site-wide we used the Organic Groups Theme module
searches but also searchable, filterable to allow a unique Drupal theme to be
listing pages. We build listings with Solr assigned to any conference. The look of
rather than traditional (usually Views conference microsites is customized through
module-based) database queries to get the UI with banner logos, and the visual
fast results, full content search and facets. themes are created with CSS. These custom
We created three search pages, one each themes are subthemes of a conference base
for proceedings, multimedia and site-wide theme. We included a conference subtheme
search. Each uses custom Solr index fields, starter kit with basic CSS for common
custom Facet API module sorts and custom elements altered between conferences. The
search-result displays. We also created (and Organic Groups Menu module provides
contributed) Facet API drop-down menus each conference with its own navigation.
for the proceedings and multimedia search Each microsite consists of page, session,
pages. Because the search work was built paper, training, sponsor, speaker and
first for Drupal 6, we used the Apache Solr organizer content types.
Search Integration module rather than the The conference microsites display
next-generation Search API Drupal suite. conference-specific Views module listings
Search API allows site builders to use the (such as lists of organizers, speakers and
Views module to build custom search attendees). We used the Viewfield module
listings quickly through a UI. so that conference administrators simply
could add a page to a conference and
Microsites include one of these predefined Views
Organic Groups, the Drupal module that listings. Because the page itself is a part of
powers groups.drupal.org to allow groups of the conference, the Views listing filters its
people to organize themselves organically, results for the context of the conference.
can be used effectively in many use cases This approach also allows the listing pages
that involve groups of site users and to include custom text before and after
content. For USENIX.org, the groups are the listings, to create an appropriate URL
the conferences, and both users (attendees) and to pick up the conference theme

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 155

LJDrupalSupplement.indd 155 9/15/12 9:59 AM


INDEPTH

Figure 3. A conference microsite has a custom theme, banner, navigation and content,
such as sessions and sponsors.

automatically. It also keeps content schedule pages, for example, vary in format
creators in the familiar content creation between conferences. The staff wanted full
interface rather than requiring them to control over the markup of these individual
learn another Drupal system. listings while still benefiting from dynamic
Some of the conference pages required content management of each session
even more customization, pushing past displayed on the schedule. For these cases,
the limits of what can be automated and we implemented a token-based HTML
programatically displayed. The conference system. With this system, an editor creates

156 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 156 9/15/12 9:59 AM


INDEPTH

a content node of type schedule and is Data Migration


presented with a content creation form The legacy USENIX content was a migration
including a textarea containing a sample challenge because it was all hand-written
HTML template for the schedule. A list of HTML. Typically, content migration can
all sessions within the conference and their make use of an existing database or at
corresponding token codes also is displayed. least consistency created by a templating
Editors can adjust the HTML as they please system. This content was not only hand-
and paste in these token codes for each written but it also had been added on-
session on the schedule. When displayed, line since 1993, so that there were major
the token codes are replaced dynamically changes to the markup over time. We
with the appropriate session displays. began the migration process by identifying
content that was critical to the new
Multimedia and CDN USENIX Web site as opposed to that which
For years, USENIX created videos of could be maintained in its legacy form.
conference presentations in a variety Of the critical content, we distinguished
of formats. In the process of moving between content that had enough
these videos to the new site, we scripted structure to be scraped programmatically,
their conversion to the Ogg and H.264 and that which required manual migration.
encoding. Similar work was performed There was also a WordPress blog that was
with existing audio files. All media files migrated into Drupal, but WordPress-
now are stored on Rackspace Cloud Files to-Drupal migration is a trivial process,
CDN and referenced by Drupal via link thanks to WordPress Import and WordPress
fields. When links are pasted into these link Migrate Drupal modules.
fields, they are displayed automatically as
HTML5 video available in WebM, H.264 or Legacy Content
Ogg, with Flash as a fallback option. Some content was not critical for full
The Rackspace Cloud Files CDN is also integration into the new site. For example,
used to host public PDF files on the USENIX driving directions to a conference in
Web site. We built a custom integration 1995, while fine to archive, was not
using the PHP Cloud Files API to queue worth migrating. We used the old sites
the bidirectional transfer of these files content directories to create a list of all
between the Web site and the CDN as the URLs on the old site and scraped each
dictated by access permissions. As a result, pages full HTML into a Drupal node. This
content editors can manage files on the legacy content, which included Listserv
site without concern for the CDN and the discussions, was indexed by the Apache
appropriate links are shown to site visitors. Solr search engine so that it can be found

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 157

LJDrupalSupplement.indd 157 9/15/12 9:59 AM


INDEPTH

Figure 4. A treasure-trove of conference recordings was made available for all


browsers and devices.

in site-wide searches. Viewing these Drupal node reference fields. These imports had
nodes of legacy content results in a redirect to be repeated as new content was added
to the page on the real legacy site, now to the legacy site, so they were written as
hosted at http://static.usenix.org. Drupal modules containing custom Drush
commands. These commands took a URL
Scraped Content and scraped its HTML, parsed it into arrays
We used the Simple HTML DOM parser to of data, built Drupal objects representing
traverse sections of the old USENIX Web site content, files, products or categories and
and programmatically create new Drupal saved these programatically. This approach
nodes with dates, files, images, text and was used to import some conference

158 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 158 9/15/12 9:59 AM


INDEPTH

content, magazine content and Short Topics structure: nodes of type session, paper,
in System Administration books content. discussion and speaker.

Manually Migrated Content Design and Theme


Conference proceedings are arguably the The USENIX design was started by
most important content on the site. The Nica Lorber of Chapter Three and
proceedings needed to be highly structured completed by our Creative Director,
to allow connecting content from the same Mason Wendell, in collaboration
presenters, connecting content from the with USENIX staff. Themes were
same conferences, organizing content by built with Sass/Compass using the
awards won and listing content by date. Coding Designer Survival Kit
Media on these proceedings including (http://thecodingdesigner.com/survivalkit).
PDFs, slides and videos also needed to
be structured. The original content was Credits
extensive and lacked a consistent structure n Drupal development and design
that would be needed for scraping. by Zivtech: Jody Hamilton (project
To facilitate the necessary manual lead), Howard Tyson, Matt Klein,
migration of the proceedings of hundreds Steve Heise, Mason Wendell, Sean
of conferences, we built a custom Wolfe, Benji Davis, Stephen Haslett,
migration interface into the development Laurence Liss, Justin Randell, Andrew
site using the Views Bulk Operations and Morton and Meghan Palagyi.
Workflow modules. We hired contractors n Design by Chapter Three: Nica Lorber.
to use the interface, which consisted of a n Hosting by Pantheon: Josh Koenig
Views listing of each legacy conference and and David Strauss.
its status (incomplete, complete, duplicate n USENIX project leads: Casey Henderson,
or not applicable). Each legacy conference Jane-Ellen Long and Anne Dickison.
was a link to a data entry form that n Video encoding: Joseph Schwartz
consisted of an iframe showing the legacy via USENIX.
proceedings of the conference and a form n Salesforce development by
for entering in fields, such as title, date, Heller Consulting: Bran Scott
authors, slides and video. We designed and Kim Kupferman.
the structure of the imported content to
make import as quick as possible for the Jody Hamilton is CTO and partner at Zivtech (http://zivtech.com),
manual process. After entry of thousands a Philadelphia-based open-source consultancy. She has
of conference proceedings, we converted been a Drupal developer since 2006 and contributes to core
the resulting nodes into their final data and contributed modules on drupal.org.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 159

LJDrupalSupplement.indd 159 9/15/12 9:59 AM


COMMUNITY
Contributing
to Drupal:
Open for All!
Drupals contribution process is open and straightforward.
Its also the fastest route to mastering this CMF.
KOJO IDRISSA

Drupal is an open-source Content This article focuses on Drupals core,


Management Framework (CMF) how you can contribute to the project
that allows you to build a Content and why youd want to. Ill start with
Management System (CMS) that fits your the why, and then move on to the
needs. This article doesnt go into detail various methods of how.
about the differences between a CMS
and a CMF. The article Drupal Is Not a What Is Drupal and What Makes
CMS (http://www.palantir.net/blog/ Up Its Core?
drupal-not-cms) by Larry Garfield of Drupal Core is the basic functionality
Palantir (known as crell on Twitter and common to any Drupal-based CMS. Like
IRC) does an excellent job of explaining the Linux kernel, its not Drupal without
this distinction. Whats important to core. When you download Drupal,
readers of this article is the basic structure youre downloading core. In addition to
that makes Drupal a framework. Theres core, there are several optional pieces
a core (analogous to the Linux kernel in of software (called Modules in Drupal-
many ways) that contains the basic Drupal speak) that add useful functions to the
functionality. This is what you get when core. These range from the nearly critical
you download Drupal. The additional modules like Views and CCK, used on
functions come from contributed modules, most Drupal projects, to modules meant
which add capabilities to Drupals core. for very specific use cases.

160 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 160 9/15/12 9:59 AM


COMMUNITY

Why Would I Contribute to Core? In some cases, there may be certain,


If you already know you want to specific functionality you need or want
contribute to Drupal core, skip ahead to that doesnt already exist in Drupal. In
the How section of this article. There that case, you can add functions to an
are several reasons you would want to existing module or create a module of
contribute to Drupal core, mostly related your own. Please, dont hack core. Drupal
to how you use Drupal or plan to use it. is written in PHP, and core is designed in
As mentioned earlier, Drupal is a CMF, a modular fashion to accept these new
allowing you to build a custom CMS that functions. Contributing to core will give
suits your needs more easily. In some you stronger understanding of the best
cases, that may mean combining pre- ways to create your new modules to best
existing contributed modules. If youre work with what core or other existing
someone whos using Drupal to build modules already provide. You may not
Web sites or a custom CMS (perhaps need to create a complex new module
an intranet), but youre not planning to perhaps all thats needed is a small extra
make any changes to Drupal (such as bit of functionality. The more you know
adding new code to a module), making about what core provides and how it
contributions to core can give you a provides it, the less youll have to create.
better understanding of how the system Remember, as Eric Raymond says, No
works under the hood. This, in turn, can problem should ever have to be solved
help you make more educated decisions twice (http://www.catb.org/esr/faqs/
about which contributed modules to use hacker-howto.html#believe2).
as you build your project. As an example, The above examples assume youre
you may have a scenario where site speed someone whos already using Drupal
is critical. There may be two modules but not making contributions to core.
that perform a similar function, but one If thats the case, consider this: Drupal
may have been built with an emphasis on is a growing and evolving system. By
ease of use/configuration (which we all contributing to core, youre in a great
like), while the other may have been built position to learn more about where Drupal
for performance. A better understanding is going in the future. As an example,
of how Drupal core works can help you the current version of Drupal is Drupal 7.
decide whats best for your use case and Drupal 8 is going to be awesome! How do
what to do when your needs change I know that? Making small contributions
and, you know theyll change. to core keeps me in the loop about whats

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 161

LJDrupalSupplement.indd 161 9/15/12 9:59 AM


COMMUNITY

happening. But, what about people just you use Drupal are the people who built
starting with Drupal? Drupal. How can you meet these people?
Say youre a system/network/database By contributing to core.
admin whos had Drupal thrust upon
you by someone higher up. That never How Can I Contribute to Core?
happens, right? I had a sysadmin friend The first thing you have to do to before
recently tell me that someone in her you can make a contribution to Drupal
organization was excited about using core is register for an account at drupal.org.
Drupal. Whats that going to mean for This allows you to do all sorts of small
my friend? You probably dont care, things immediately, such as update
but you do care about what it would documentation. You can contribute in
mean for you, dont you? Contributing several different ways. For the Linux
to core can help you get a much better Journal audience, Ill first focus on the
understanding of how a Drupal system standard approach, which is more
may impact the system/network/database developer-centric and involves using the
resources you administer. This is especially Drupal Issue Queue. After that, Ill go
true once you figure out what your into some ways even a non-coder or
organization wants to do with Drupal. non-technical person can contribute.
I look at specifics regarding that in the
How section of this article. Code Monkey Climb Ladder,
What if youre the Web person Help Drupal!
for your organization whos had Drupal The approach most developers (but not
thrust upon you, but with a mandate just developers) will be comfortable
to make it usable, pretty and accesible with can be seen on the Drupal
or to look like our company, not every Ladder (http://drupalladder.org/
other Drupal site? First, realize how ladder/ee503327-50be-1904-8d04-
lucky you are to have higher-ups who are 9499098cad64). The Drupal Ladder is
enlightened enough to choose Drupal. the result of an effort to get more people
They could have thought Flash was the involved in contributing to Drupal core. It
next big thing. Second, realize that is made up of lessons and materials to
contributing to core can help you learn help people learn about and contribute
the best ways to do that. Again, more to Drupal (http://drupalladder.org/
details on that in the How section. node/1). Its also worth noting that
If youre someone new to Drupal, Drupalize.me, an on-line repository
youll probably want all the help you can for Drupal training videos created by
get. The people best positioned to help Lullabot, has a free Learn the Drupal

162 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 162 9/15/12 9:59 AM


COMMUNITY

Ladder (http://drupalize.me/series/ Drupal project founder and lead, Dries


learn-drupal-ladder) series of videos Buytaert. Instructions for installing the
available for viewing. At the time of this Acquia Dev Desktop can be found in
writing (August 2012), four videos are the second video in the Learn Drupal
available, going through the Getting Ladder series mentioned earlier.
Started in the Issue Queue rung of the After youve got your *AMP stack
ladder, with at least two more in the going, its just a matter of downloading
works. Those are excellent resources the latest version of Drupal. If youre
as well. The first two steps are basic happy with the Linux command line,
setup. If youve already got a local Web the Quick install for developers
development environment and Git setup, (command line) (http://drupal.org/
feel free to skip ahead to step 3. documentation/install/developers)
approach should work just fine,
Step 1: Get Drupal Installed starting with:
Locally
This involves setting up a local *AMP wget http://drupal.org/files/projects/drupal-x.x.tar.gz

stack (with the P being PHP) and tar -zxvf drupal-x.x.tar.gz

downloading/installing the latest version


of Drupal. For most Linux Journal Otherwise, you can go to
readers, this shouldnt be a problem, as http://drupal.org/download for the
most Linux distros already include this latest version of Drupal 7 (which is the
software. If youre not running Linux, current version of Drupal as of August
youve got a couple options. You can use 2012), or you can go to the releases
WAMP (http://www.wampserver.com/ page (http://drupal.org/node/3060/
en) for Windows or MAMP release) to find anything from Drupal 4.7
(http://www.mamp.info/en/index.html) to the latest update to Drupal 8 (under
for OS X. Drupalize.me has free development now). Refer to Drupals
videos to help with installing WAMP Installation Guide for further details.
(http://drupalize.me/videos/
installing-wampserver) or MAMP Step 2: Install Git
(http://drupalize.me/videos/ Drupal uses Git for version control, and if
installing-mamp-web-server) for those youre going to be helping with the Issue
needing help. A second option, for both Queue, youll need it installed locally as
platforms, is the Acquia Dev Desktop. well. Instructions for installing Git are
This is an *AMP package created by beyond the scope of this article, but once
Acquia, a Drupal company started by youve got it installed, there is a set of

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 163

LJDrupalSupplement.indd 163 9/15/12 9:59 AM


COMMUNITY

instructions specific to working with Drupal 2. Someone working on the issue queue
core (http://drupal.org/project/drupal/ tests an issue to see if they can reproduce
git-instructions) available for those new it. If they cant reproduce it, theyll post a
to Git or Drupal. Dont forget, theres comment for that issue, probably asking
also a lesson at the Drupal Ladder site for more information. This will alert the
(http://drupalladder.org/lesson/ original poster and anyone else who may
027b5839-7a74-af04-6905-fee2d01c7ef4) be following that issue. If they can,
and a video at Drupalize.me. With the theyll add a comment noting this and
first two setup steps out of the way, perhaps move on to the next step.
youre ready to dive into the Issue Queue 3. Someone sees an issue they know
and start meeting Drupal Folks. how to fix. They may explain what
needs to be done (this is often done by
Steps 35: Using the Issue more experienced developers when they
Queue and Interacting with the encounter easier problems) or create
Drupal Community the patch they think will fix the issue.
Now, Im going to depart a bit from When a patch is created, its submitted
following the Drupal Ladder, by outlining by attaching it to a new comment in the
the basic steps for dealing with a bug in issue queue. Drupals automated testing
Drupal core, which probably are similar system (SimpleTest) will do basic testing
across open-source projects. Whats on the patch.
important to note is that youre helping by 4. Someone sees a patch that has passed
taking part in any of these steps. Please automated testing and will test it manually
note, this is my broad strokes overview on their own local Drupal install. Theyll
of the process. Its not an official include before-and-after screenshots of the
outline or process document. Im sure behavior that created the bug and how its
Im leaving out some details, but this will been fixed (or not fixed).
more than suffice for an introduction: 5. Someone with commit access (a small
1. Someone has a problem and adds group of people, https://drupal.org/
an issue to the Drupal Core Issue Queue node/3060/committers) will commit the
(https://drupal.org/project/issues/ successful patch to Drupal core after its
drupal?categories=All). When doing been successfully Reviewed and Tested By
this, be as detailed as possible about the the Community (RTBC)
conditions that cause the bug to appear.
People will need to be able to reproduce Focus on Your Strengths
it. Screenshots help. You need to have an My use of the word someone in the
account on drupal.org to post an issue. steps above was important because you

164 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 164 9/15/12 9:59 AM


COMMUNITY

could be the someone in each or any on back-end developers, but if youre


of those steps (except the last one) in good with the front-end stuff, you may
the process, but for a different issue. be able to point out, suggest or create
It all depends on the issue and your patches to core issues quickly, without ever
abilities. As an example, if you know how leaving your comfort zone. Again, once
to download a file from the Web, take youve climbed those first two rungs of the
screenshots of whats on your computer Drupal Ladder, you can go to town.
screen and upload a picture to the Web,
you can do step 4 above. You just need Strength in Numbers: Core
to learn the first two rungs of the Mentoring Hours
Drupal Ladder (install Drupal locally and One of the best benefits of working
install Gitremember, there are free with Drupal is the great community. Its
videos to show you how), and youre honestly one of the biggest reasons Ive
ready to go. If you dont know how to spent so much time learning more about
create or apply a patch with Git, the Git Drupal. More than just a CMF, Drupal,
instructions for working with Drupal core like Soylent Green, is made of people
(http://drupal.org/project/drupal/ great people. You can leverage those
git-instructions) tell you how. This step great people as you learn to contribute
is a critical step, and if thats all you ever by participating in Core Mentoring Hours
do to contribute to Drupal core, youll be (http://drupal.org/core-office-hours).
appreciated more than you know. But, it Core Mentoring Hours (which you
also could be a great entry point to other may sometimes hear called Office
types of contributions. Hoursit was originally called Core
Similarly, step 3 above provides an Office Hours) got started in August
opportunity to focus on your areas of 2011 as an effort to get more of the
expertise. Theres more to Drupal than Drupal community involved in helping
just PHP. Theres a lot of markup with contributions to core. As with
(https://drupal.org/project/issues/ many projects, you find a small group
drupal?categories=bug&component= of people carrying a lot of the weight.
markup), including HTML5, CSS If more people could be recruited to help
(https://drupal.org/project/issues/ with some of the tasks (like steps 3 and 4
drupal?categories=bug&component=CSS) above), that would create two benefits.
and JavaScript (https://drupal.org/project/ First, it would leave the Drupal architects
issues/drupal?categories=bug&component free to focus on higher-level stuff
=javascript) in Drupal core. Each category (instead of fixing typos in text strings, an
has issues. The Drupal community is heavy actual issue Ive worked on). Second, it

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 165

LJDrupalSupplement.indd 165 9/15/12 9:59 AM


COMMUNITY

would help build new Drupal architects more concerned with the cache
by letting members of the community (https://drupal.org/project/issues/
learn more about the inner workings of drupal?categories=bug&component=
Drupal. The benefit for new contributors cache+system) or database
is that theres now an official, well-formed (https://drupal.org/project/issues/
(and constantly evolving) on-ramp for drupal?categories=bug&component=
new contributors. database+system) systems and how
Currently, Core Mentoring Hours they work. Looking at bugs related
happen twice each week, Tuesday, to those systems can help expand her
02:0004:00 UTC, and Wednesday, understanding of how they function.
16:0018:00 UTC. Here in Texas, thats If her organization is using MySQL
911pm Mondays and 11am1pm (https://drupal.org/project/issues/
Wednesdays. The Core Mentoring page drupal?categories=bug&component=
has time-zone converters so you can mysql+database) or PostgreSQL
find your local times. If you can make (https://drupal.org/project/issues/
yourself available during one of those drupal?categories=bug&component=
time slots, go into the #drupal IRC postgresql+database), she may want to
channel on freenode.net and announce focus more on those. The Web person
that youre there for Core Mentoring may want to focus more on things like
Hours (http://drupal.org/irc). You the markup, CSS or JavaScript subsystems
promptly will be put to work and/or I mentioned earlier. Or, if the site has a lot
assisted with questions you have about of community activity, maybe looking at
how to contribute. I participated in the the Comment module (https://drupal.org/
first COH/CMH last August, and Ive project/issues/drupal?categories=bug
learned quite a bit. &component=comment.module) would
be helpful.
Step 6: Pick Your Spots, Call If you know what parts of Drupal
Your Shots youre more interested in, point that
Remember those examples I mentioned out while youre in Core Mentoring
about the people who had Drupal Hours, and you can work on those areas.
thrust upon them? Remember when Or, work on it on your own. Another
I said youd be able to find ways to option is to look at the various Drupal
contribute that would benefit your 8 Core Initiatives (http://drupal.org/
specific functions? This is where the community-initiatives/drupal-core),
various Drupal core subsystems come which focus almost exclusively on
into play. My sysadmin friend may be specific areas, such as configuration

166 / SPECIAL DRUPAL ISSUE / WWW.LINUXJOURNAL.COM

LJDrupalSupplement.indd 166 9/15/12 9:59 AM


COMMUNITY

management, Web services or mobile. above. If youre curious about any of them,
Discussion of those topics deserves you can take a look at the docs Ive linked
its own article, but take a look at the to or ask in Core Mentoring Hours.
Initiatives page and see what looks good.
Conclusion
Im No Code Monkey Genius, Drupal is an excellent CMF that offers a
So I Cant Contribute lot of functionality out of the box, as well
There are a number of ways non-coders as for people wanting to build something
can contribute. Every issue in the core custom. In a more general sense, Drupal
queue should have a clear, concise is also an open-source project with a very
summary. They dont. The Issue Summary welcoming and supportive community. In
Initiative (http://groups.drupal.org/ the words of Angela webchick Byron,
node/167534) looks to fix this. If you open-source evangelist, a Drupal core
can read and write English, you can help co-maintiner and April 2011 Linux Journal
here. Change notices (http://drupal.org/ cover girl (http://www.linuxjournal.com/
node/1314040), although slightly more content/interview-angie-byron-drupal),
technical, involve documenting changes Drupal is a Do-ocracy. Its not about
that already have been made. So, if who you are; its about what you do.
theres a patch that changes an API or My own experiences have confirmed
adds/removes a function, a Change this. Theres very little cliquishness, and
Notice is needed. Heres an example of anyone whos willing to learn about
one I worked on for a new function that the community standards is welcome
themes (styles) date/time information to contribute. This article exists only
(http://drupal.org/node/1441334). I because Ive come across so many smart
didnt write the patch, just the Change and helpful people contributing to the
Notice. Finally, as a member of drupal.org, Drupal community. Join us!
you can update most of the documentation
on the site, and there is a lot! As an Kojo Idrissa is not an MBA. He has an MBA. Theres an important
example, while I was writing the paragraph difference. A holistic mixture of tech guy, business guy,
on Core Mentoring Hours, I updated China guy and educator, he fits into more than one space.
the time-zone conversion link for 02:00 When hes not being that guy, hes learning new ways to
UTC Tuesday. It was going to 02:00 UTC build things and solve problems with technology, improving
Monday, probably because the Mentoring his Chinese or honing his teaching skills. Hes co-SIG Leader
Hours started on Monday/Wednesday. It (and resident Drupal Guy) of the HAL-PC Web Design
was a simple fix, but each bit helps. SIG and a member of the Houston Drupal User Group. Hes
Ive done all three of the things mentioned Transition in the Drupal IRC channels and on drupal.org.

WWW.LINUXJOURNAL.COM / SPECIAL DRUPAL ISSUE / 167

LJDrupalSupplement.indd 167 9/15/12 9:59 AM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy