18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Developing for <strong>Drupal</strong> 7<br />

The theme system<br />

The final component from our initial architectural diagram is the theme system.<br />

<strong>Drupal</strong> separates the look-and-feel components of the system from the rest of<br />

<strong>Drupal</strong>, and provides a programmatic way for theming data. The system for<br />

handling this is collectively called the theme system.<br />

Some of the theme system resides in the <strong>Drupal</strong> core libraries. This part is<br />

responsible for initializing themes and locating what theme functions and<br />

templates should be applied under certain circumstances.<br />

However, the majority of the theme code resides in themes and modules.<br />

A theme is a structured bundle of code (like a module) that provides tools<br />

for transforming raw data into formatted output. Sites use at least one theme<br />

to apply a consistent and custom look-and-feel to all of the pages on the site.<br />

However, Not all theme code resides inside of a theme. One of the distinct<br />

advantages offered by <strong>Drupal</strong> is the capability to define default theming inside<br />

modules, and then provide mechanisms by which the theme layer can selectively<br />

override those themes. In other words, a module might declare a rough layout for a<br />

component, but <strong>Drupal</strong> provides the structure for a theme developer to later modify<br />

the theme (not the module) to re-layout that component in a different way.<br />

If this all sounds conceptually difficult, don't worry. Chapter 3 and Chapter 4 of this<br />

book are dedicated to working with the theming system.<br />

Now that we've had a quick architectural overview, let's change perspectives and<br />

quickly peruse the major subsystems offered by <strong>Drupal</strong>.<br />

<strong>Drupal</strong>'s major subsystems<br />

In the previous section we took a birds-eye view of <strong>Drupal</strong>'s architecture. Now we<br />

are going to refine our perspective a bit. We are going to walk through the major<br />

subsystems that <strong>Drupal</strong> 7 has to offer.<br />

Themes<br />

The theme subsystem was introduced above, and since Chapter 3 and Chapter 4 will<br />

cover it, we won't dwell too much on it here. However, there are a few details that<br />

should be mentioned at the outset.<br />

[ 16 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!