Templates

Adaptivetheme include a number of template overrides to support its HTML5 output and to ease code management by offering features to reduce the reliance on template suggestions and allowing you to theme from preprocess and process functions with more granularity and control.

This page includes a brief overview of each template and what changes have been made to override Drupal 7 cores output. Some templates have more extensive documentation due to additional features provided by that template - also see the relevant preprocess and process functions for each template if linked to (the docs are currently under construction, its worth checking back to see if they have been added).

AT 7.x-3.x makes heavy use of preprocess functions and extends them with a number of helper functions to ease code management via various layers of abstraction. Where appropriate the docs will link to additional pages documenting these abstraction layers. One of the largest is the load system, which abstracts the loading of CSS and JS files from adaptivetheme_preprocess_html() to load.inc and its various file loading functions.

$is_mobile

$is_mobile is available to all templates if you install the Browscap module. You can use this to conditionally show or hide content in mobile devices. Adaptivetheme includes special integration with Browscap to enable the $is_mobile bool (returns TRUE if a mobile device is detected), and uses it to power its own Mobile Regions and Blocks feature.

html.tpl.php
  • DOCTYPE for HTML5
  • IE conditional classes on the HTML element, much like HTML5 Boilerplate provides.
  • $html_attributes variable that includes the lanaguge and language direction.
  • $polyfills variable that prints IE conditional scripts, which can be added via the info file: see - IE Styles and Scripts.
  • For site builders and developer the skip navigation target ID is set through a new variable $skip_link_target. This can be set in your sub-themes Appearance settings under Extensions > Markup Overrides > Accessibility, with the default set to #main-content.

@see adaptivetheme_preprocess_html()
@see adaptivetheme_process_html()

page.tpl.php
  • $site_logo: Themed logo - linked to front with alt attribute.
  • $site_name: Site name linked to the homepage.
  • $site_name_unlinked: Site name without any link.
  • $hide_site_name: toggle_name boolean, used to toggle the visibility is the site name.
  • $visibility: Holds the class .element-invisible or is empty. Used to hide the site name if turned off in toggle settings (same behavior as Bartik).
  • $primary_navigation: Themed Main menu. Uses theme_links() and h2 header.
  • $secondary_navigation: Themed Secondary/user menu. Uses theme_links() and h2 header.
  • $primary_local_tasks: Split local tasks - primary. Allows you to print the primary local tasks separately from the secondary tasks.
  • $secondary_local_tasks: Split local tasks - secondary. Allows you to print the secondary local tasks separately from the primary tasks.
  • $tag: Prints the wrapper element for the main content, either a section or div element.

@see adaptivetheme_preprocess_page()
@see adaptivetheme_process_page()

page--full-width-wrappers.tpl.php
This page template that has 100% width wrappers, which effectively divide the page up into sections to you can style with full width backgrounds. To use copy this to your subtheme and rename it to page.tpl.php, or enable this in theme settings under Extensions > Markup Overrides > Design.
region.tpl.php
    The region template works a little differently and uses variables to print the markup. You can overrides this with a normal template suggestion in your subtheme or theme it from themeName_process_region() - please see the additional docs on this template.
  • $outer_prefix: Outer div with region classes.
  • $outer_suffix: Closing element.
  • $inner_prefix: Inner div with .region-inner and .clearfix classes.
  • $inner_suffix: Closing div.

@see adaptivetheme_preprocess_region()
@see adaptivetheme_process_region()

You can also use a region--sidebar.tpl.php file to theme both sidebars at the same time.

block.tpl.php
The block template in Adaptivetheme is a little different to most other themes. Instead of hard coding its markup Adaptivetheme generates most of it in adaptivetheme_process_block(), conditionally printing outer and inner wrappers. This is the same as how region templates work and you can override it with a standard block template suggestion in your sub-theme or theme it from themeName_process_block().
  • $outer_prefix: Holds a conditional element such as nav, section or div and includes the block id, classes and attributes.
  • $outer_suffix: Closing element.
  • $inner_prefix: Inner div with .block-inner and .clearfix classes.
  • $inner_suffix: Closing div.
  • $title: Holds the block->subject.
  • $content_processed: Pre-wrapped in div and attributes, but for some blocks these are stripped away, e.g. menu bar and main content.

@see adaptivetheme_preprocess_block()
@see adaptivetheme_process_block()

Additional template suggestions are supplied for the menu bar region - please view the full docs page or the actual code in adaptivetheme_process_block().

node.tpl.php
field.tpl.php.txt
comment-wrapper.tpl.php
comment.tpl.php
aggregator-feed-source.tpl.php
aggregator-summary-items.tpl.php
aggregator-item.tpl.php
panels-pane.tpl.php
book-navigation.tpl.php
maintenance-page.tpl.php

Last updated 4th July, 2012 - 10:50pm