Book Image

Drupal 7 Theming Cookbook

By : Karthik Kumar
Book Image

Drupal 7 Theming Cookbook

By: Karthik Kumar

Overview of this book

<p>The greatest strength of Drupal lies in its design which, when employed correctly, allows developers to literally handcraft every aspect of a site, so that it looks and performs exactly how they want it to. While it is reasonably straightforward to download a Drupal theme and install it, doing anything beyond that is not. Using custom themes requires familiarity and experience with Drupal's theming system, especially if you want to easily administer and maintain your themes.</p> <p>Drupal 7 Theming Cookbook provides a plethora of recipes that enable Drupal template designers to make full use of its extensibility and style their site just the way they want it. It is a well-rounded guide which will allow users to take full advantage of Drupal's theming system.</p> <p>This cookbook starts with recipes which address the basics of Drupal's theme system, including regions and blocks. It then moves on to advanced topics such as creating a custom theme and using it to modify the layout and style of content. With the introduction of the Field API and the growing importance of Views and Panels in Drupal 7, chapters have been dedicated to each feature. You will also learn many techniques for dealing with Drupal&rsquo;s templating system, which will allow you create themes which surpass even the existing Drupal and contributed modules.</p>
Table of Contents (18 chapters)
Drupal 7 Theming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Adding a slogan to the theme


This recipe details the steps involved in adding a slogan to the theme. Site slogans are a common feature on most sites and are typically witty or involve clever wordplay. They are synonymous with catchphrases, taglines, mottoes, and so on.

Drupal offers a global setting to store the site slogan which is customarily displayed by themes near the site logo or site name and is also regularly added to news feeds and site e-mails as part of the site’s identity.

Getting ready

Think up a good slogan! This is the biggest stumbling block to getting this recipe right.

How to do it...

Adding a slogan to a theme involves the following steps:

  1. 1. Navigate to admin/config/system/site-information [Home | Administration | System | Site information].

  2. 2. Locate the Slogan textfield and add the slogan here as shown in the following screenshot:

  3. 3. Click the Save configuration button at the bottom of the page to save our changes.

  4. 4. Now, navigate to the theme administration page at admin/appearance [Home | Administration | Appearance].

  5. 5. Click on the Settings tab at the top of the page.

    The resulting page should have multiple tabs: one titled Global settings which affects all themes and others representing each enabled theme. Configuration options under the Global settings tab serve as the site’s default settings for all themes, while equivalent settings within each theme’s tab work as overrides for the global settings.

  6. 6. On the Global settings page, look for the Site slogan setting in the Toggle display section and ensure that it is checked:

  7. 7. Click the Save configuration button to save our changes.

Note

If any of the themes have overridden the global setting, then the Site Slogan checkbox will also need to be checked in its respective theme tab.

How it works...

Drupal saves the provided slogan as a configuration setting in the database. The theme system makes this setting available as a variable to the theme which outputs it accordingly when the page is being rendered.

In the following screenshot, we can see that the slogan is enabled and is displayed along with the logo and the name of the site:

There’s more...

Besides the site slogan, other theme variables can also be configured from the Site information and theme configuration pages.

Similar settings

The Drupal Site information page seen in this recipe also contains fields for other settings such as the Site name which are also similarly exposed by themes. Toggles for these as well as other variables can also be controlled via the theme system’s Global settings tab.

See also

Two previous recipes in this chapter, Uploading a new logo and Uploading a new favicon, deal with altering similar variables via the theme configuration pages.