Overriding Functions

As discussed in Chapter 3, the themeable functions in Drupal control the HTML formatting for the final display of the contents. You can control the look and feel of the site by modifying the CSS together with the themeable functions. While CSS gives you one level of control over look and feel, to make significant changes to the functionality or the page layout you will need to work with the functions themselves.

The default themeable functions are located in a variety of files inside the distro (see, Chapter 4 for a listing). If your site is using a theme engine, you may also find themeable functions located inside the theme engine directory. Finally, themeable functions may be found inside the active theme's directory.

All themeable functions in a Drupal site can be overridden. As we saw with style sheets, there is a hierarchy at work inside Drupal. The Drupal system will seek out themeable functions in a specific order, and apply the first one it finds.

The themeable function hierarchy is invoked through the use of a naming convention. The default themeable functions can be identified by their names:

all employ the nomenclature theme_functionname (). For example, the default themeable function that controls the output of a Drupal breadcrumb trail is named theme_breadcrumb().

[ _The default breadcrumb function is located in the includes/theme . inc

* file. We will be looking at this function throughout this chapter, particularly in relation to the way it is overridden in the Garland theme.

0 0

Post a comment