Many of the concepts in Tao for Drupal 6.x have been addressed by the theme layer of Drupal 7 in one way or another. As a result, various parts of Tao have been refactored and other parts are up in the air conceptually.
Tao is a base theme for Drupal that is all about going with the flow. It is not meant for general-purpose use, but instead takes care of several tasks so that sub-themes can get on with their job:
Tao makes several assumptions about how you, the themer, would like to work with Drupal and the theme system:
The following is a comprehensive list of things to know about Tao as a subthemer.
Tao leaves most core element markup alone. When things don't make sense, however, it makes changes and aggressive ones at that. Here's a list of things to expect:
theme('fieldset')
The fieldset
element in core has been retained but with additional markup
for simpler theming. The legend
element contains a sub-element span
that
can be positioned properly across browsers and the main contents of the
fieldset follow other object templates with a .fieldset-content
div.
theme('form_element')
To distinguish between different instances of the .form-item
wrapper, Tao
adds a .form-item-labeled
class to labeled items and .form-item-option
to
checkboxes and radios.
theme('pager')
All numeric page links are grouped together into a ul.pager-list
set.
Next/previous links are grouped together under ul.pager-links
.
theme('username')
All username instances are wrapped in an a.username
or span.username
.
$attr
variableThe $vars['attr']
variable is the standard way for adding any HTML attribute
to the major containing element of the corresponding template. The
drupal_attributes($attr)
is used in each template to render attributes. For
example, to add a class to a node, you would add the following to your
subtheme's node preprocessor:
$vars['attr']['class'] .= ' myclass';
Tao implements an aggressive reset.css
but also strips out the inclusion of
many of the CSS files included in core with the exception of colors.css
and
locale.css
(see tao.info
for the specifics). Tao reimplements and
consolidates Drupal core CSS styles in a way that will not affect a
typographical or other strict grid in drupal.css
that can be overridden by
sub themes for even greater control.
Tao does not remove any contrib CSS added from other module directories, e.g.
sites/all/modules
or profiles/myprofile/modules
.
Note: The main reason for the stripping of core CSS is to achieve consistent
typography and grid layout. Many styles in Drupal core add inconsistent
padding
, line-height
, and font-size
adjustments to elements, making it
extremely costly to hunt down individual instances and correct them.
Tao allows a site's print stylesheets to be previewed by checking whether
$_GET['print']
is set. For example, to preview a node's print stylesheets, you
would go to http://example.com/node/5?print
. Other niceties related to print,
like support for full expansion of a book tree on print, has been added.
media='all'
Tao does not use the all
key for any of its stylesheets and expects that you
will not either. Be specific - if the stylesheet is for the screen, or for
print, say so. Any stylesheet overrides your subtheme provides should use the
same media key as the one in tao.info
for the stylesheet that is being
overridden.
reset.css
provides browser CSS style resets and core styling resets.
Override this in your subtheme only if you need to add or omit certain reset
styles.base.css
provides very basic structural, non-aesthetic styling for many
elements. See inline comments for more information.print.css
is a default print stylesheet. Override this in your subtheme to
alter print styling entirely.All of the following theme functions go through the exact same template in Tao
(with the exception of node
and fieldset
which go through slightly modified
versions for better usability and compatibility with contrib modules):
theme('block')
theme('box')
theme('comment')
theme('fieldset')
theme('node')
The template is designed to follow a strict pattern. Each element is classed as such:
[theme_hook]-[element_type]
with the name of its hook and then the type of wrapping element within the
template. For example, for a node, the following elements are provided:
.node-title
, .node-content
, .node-links
etc. For comments, the
corresponding classes would be .comment-title
, .comment-content
,
.comment-links
and so on.