changes to drupal themes in version 7 (part 1)
DESCRIPTION
Part 1 of a talk at LA Drupal about the changes from Drupal 6 Themes to 7.TRANSCRIPT
Drupal 7 Themes ( part 1 )Chris Charlton - LA Drupal - XTND.US http://xtnd.us
Added jQuery 1.4 to core
Added jQuery UI (1.8) to core
Stark is the new Zen
Based on Zen theme framework for Drupal.
Stark theme (new)
Plain white “vanilla” base theme.
CSS only sub-themes.
The box.tpl.php template has been removed
( it’s about time )
Blocks have new, more meaningful CSS IDs
Search formOld CSS ID (Drupal 6): #block-search-0New CSS ID (Drupal 7): #block-search-form
User loginOld CSS ID (Drupal 6): block-user-0New CSS ID (Drupal 7): block-user-login
The clear-block CSS class has been renamed to clearfix
Drupal 6.clear-block
Drupal 7.clearfix
Search box moved from theme layer to blocks
Primary and secondary links are now Main and Secondary menu
Drupal 6$primary_links
$secondary_links
Drupal 7$main_menu
$secondary_menu
Unrendered taxonomy links variable gone in node.tpl.php
Drupal 6$taxonomy
Drupal 7$terms
Remove $footer_message variable from page.tpl.php
remove $footer_message
$help became a region.$help still used in page.tpl.php
Drupal 7 Theme .info file:
regions[help] = Help
Mission statement removed, 'highlight' region suggested
Drupal 7 Theme .info file:
regions[highlight] = Highlight
$content became a mandatory region
Drupal 7 Theme .info file:
regions[content] = Content
$closure region becomes:
$page_bottom
$page_top
$left and $right variables are now $sidebar_first and $sidebar_second; CSS IDs also changed
Renamed $block->content to $content in block.tpl.php
There are now two sets of variables process functions
preprocess
process
Templates have a variable for CSS classes: $classes_array
<?phpfunction mytheme_preprocess_node(&$vars) { // Add an additional class. $vars['classes_array'][] = 'new-class-to-add';}?>
<div class="<?php print $classes ?>"> ...</div>
node.tpl.php:
All templates can print out dynamic attributes
$attributes
$title_attributes
$content_attributes
Variable process functions can now be used for all theming hooks
All theme functions now take a single argument
$variables
Function names must match theme name
You may no longer use phptemplate_function
CSS and JavaScript files must be specified in .info file
No more automatic style.css
No more automatic script.js
Granular rendering in node and user templates
<?php // Hide the comments and links to render them later. hide($content['comments']); hide($content['links']); print render($content); ?>
Drupal 7 outputs RDFa requiring a change at top of page.tpl.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>" <?php print $rdf_namespaces ?>> <head profile="<?php print $grddl_profile ?>">
More online
http://drupal.org/update/theme/6/7
http://tinyurl.com/theme-drupal
http://xtnd.us