Theming for Drupal Commons, Part 1: Customizing the Commons Theme

Drupal Commons is an awesome new Drupal install profile from Acquia that combines the core functionality of Organic Groups with additional modules such as shoutbox, heartbeat, user points and custom functionality into a package that allows users to quickly and easily launch a robust website geared towards growing a community. Commons is a fantastic install profile for use as a company intranet, community forum or any other situation where users rally around common interests to share information, documents and experiences.

Drupal Commons comes packaged with a theme specially built for use with the install profile, Acquia Commons, design by Acquia and built by TopNotchThemes. Since Acquia Commons is based on TopNotchThemes’ robust theming framework, Fusion, there are many different styling options that can be easily configured through the Drupal UI, without any knowledge of CSS or theming. Also, since Commons uses Panels for page layouts, customizing the presentation of your content is as easy as a few click-and-drags.

In this blog post, I’m going to go over the UI configurations available in the Acquia Commons theme, as well as show some tips and tricks for customizing the theme if you do know how to use CSS. Part 2 of this blog series will cover creating a completely custom theme using the Fusion Commons Starterkit and Part 3 will cover adapting an existing theme to work with Drupal Commons.

Featues of Fusion

A lot of the flexibility of customizing Drupal Commons comes from features of our theming framework, Fusion, and is universal to all the themes we make here at TopNotchThemes. A lot of the information I have for you in this post is a re-telling of our Fusion Documentation. If you need more info, be sure to take a look at http://fusiondrupalthemes.com/support/documentation

One of the best features of Fusion is the integration with the Skinr module. Skinr allows you to easily change some design aspects of a theme through the user interface. First, we’ll go over some of the changes you can easily make to your Drupal Commons site.

First, let’s take a look at a Commons group homepage as it looks when we first install the site.

fresh-group

One quick way to add some color to the page or to draw attention to one page element is to change the color scheme on a block. To do this, just hover over the block’s title and click on the gear icon that will appear:

group-block-hover

On the block configuration page, you will see lots of different skinr options for styling this block. At the bottom, you’ll see the option for “Drupal Commons Colors.” Choose a different color scheme from this drop-down, save the block and return to the group homepage to see the result.

block-config orange-block

Another customization you might want to make to the Acquia Commons theme is to change some aspects of the theme’s layout. You can easily make a few tweaks to the layout on the Acquia Commons theme settings page.

For example, you may wish to switch from a fluid-width layout to a fixed, 960 pixel-wide format and change the width or position of the sidebars.

change-layout

Using Panels for Content Layout

Since Drupal Commons uses panels for the layout of the homepage and group pages, it is very easy to change the layout of information on those pages. For example, on a Group page, find the “Edit Panel” tab and click on it.

edit-panel

This will take you to the Panels edit page, where you can easily drag-and-drop content blocks to re-arrange the layout of the page. You can also add or remove content.

group-page-panels

With these few user interface features, you can easily customize the layout and content of your Drupal Commons site to work best for your community.

Getting in Deeper

Inevitably, you’ll run across something you want to change about the theme that can’t be handled through the admin. You may want to change the background image, edit the color of the main navigation or even change the styling of typography on the site. In these situations, you will need to add a bit of custom CSS to the theme.

The best practice for adding your own custom CSS to any Fusion theme is to use the provided file local-sample.css. Rename this file to local.css and place any custom CSS in this file. Doing so will be helpful for two reasons; first, local.css is listed after the Acquia Commons stylesheet, so your styles will always override the default styles for the theme and secondly, keeping your CSS separate from the theme’s core CSS helps make troubleshooting and updating easier.

As an example, we are going to change the background of our Commons site to be a blue gradient instead of the Common’s gray, hand-holding people image. Our first step is to use an image editor such as GIMP or Photoshop to create our gradient image. In an effort to keep our custom changes separate from the core of the theme, we will save our image in a sub-folder of ‘images’, called ‘custom’.

custom-bg-saving

Our next step is to investigate the existing Commons CSS to find out what we need to change to use our background image.

commons-bg-firebug

From inspecting the existing CSS with Firebug, we can see that the existing background is implemented using two divs, “left-background” and “right-background,” so our first step is going to be to hide these divs since we don’t want to use that background anymore. We will add the following CSS to local.css:

#right-background,
#left-background {
display: none;
}

this should disable the people-holding-hands background image. Note: You may need to clear the site’s caches to see your changes. If you will be doing a lot of edits to the theme, it is best to disable CSS compression on the site performance page while you are working on changes to the theme.

Our next step is to edit the body tag so that it uses our blue gradient image instead of the default gray gradient. To do so, we add a little bit of custom CSS to local.css:

body {
   background: #80AED1 url(../images/custom/blue-gradient.png) repeat-x 0 0;
}

Now, if we use Firebug to inspect the body element again, we can see how our background property in local.css is overriding the background property in acquia-commons-style.css

commongs-bg-changed

Wrapping Up

Now that you know the three best ways to customize the Drupal Commons default theme, experiment and see what you can do to make the look and feel of your site perfect for your community! In the next part of our series on theming for Drupal Commons, we’ll cover how to create a custom theme from our Commons Starterkit.

Here are some helpful links to learn more about topics covered in this post:

Don’t know CSS? Learn it here: http://www.w3schools.com/css/css_intro.asp
A handy tutorial video on using firebug to troubleshoot CSS: http://www.kristarella.com/2009/02/how-to-use-firebug-for-css/
For more detailed instructions on using panels, read up on the Drupal documentation pages: http://drupal.org/node/496278.

This site runs on the Fusion theme for Drupal

Fusion is a powerful Drupal theme framework, with point-and-click layouts & built in styles for blocks, Views, and other modules. Download a Fusion theme for an instant, easy to configure design, or harness the power of Fusion in your own subtheme for a totally custom look.

And it’s free!

Comments (6)

Anonymous's picture
Anonymous

What will you cover in the

What will you cover in the second part of this tutorial ?

lajtowy's picture
lajtowy

Thankssssss

I would like to thanks for this - it's awesome ;]

Can't wait for the next parts

BR ;]

pepperstreet's picture
pepperstreet

Very useful information!

A very important and useful introduction and overview. Please make it a sticky topic on the commons site ;) Looking forward to the second part!

best regards.

Walter's picture
Walter

Are Part 2 and Part 3 available?

Dear Sheena,

I would like to know if Part 2: Creating a completely custom theme using the Fusion Commons Starterkit and Part 3: Adapting an existing theme to work with Drupal Commons, have been released.

I hope you could share them with us!

Regards

Iggy's picture
Iggy

Drupal Commons Theme Customization Tutorials?

I'd also like to know when these Drupal Commons theme tutorials will be published?

Part 2: Creating a Completely Custom Theme using the Fusion Commons Starterkit

Part 3: Adapting an Existing Theme to work with Drupal Commons

It sure would be helpful....Firebug is great, but it isn't the fastest way to plow through another coder's work.

Any update on this?

Thanks!

Zach's picture
Zach

Not working for me.

So I went through this tutorial and made the changes as outlined above yet do not see any change? I have recently updated to Commons 1.6, not sure if that has anything to do with it or not.

When inspecting the css elements, it seems to be pointing me to css files under fusion_core instead of commons_origins. Fusion_core is not enabled on the themes page. Thoughts?