27
Drupal 7 Themes ( part 1 ) Chris Charlton - LA Drupal - XTND.US http://xtnd.us

Changes to Drupal Themes in version 7 (part 1)

Embed Size (px)

DESCRIPTION

Part 1 of a talk at LA Drupal about the changes from Drupal 6 Themes to 7.

Citation preview

Page 1: Changes to Drupal Themes in version 7 (part 1)

Drupal 7 Themes ( part 1 )Chris Charlton - LA Drupal - XTND.US http://xtnd.us

Page 2: Changes to Drupal Themes in version 7 (part 1)

Added jQuery 1.4 to core

Page 3: Changes to Drupal Themes in version 7 (part 1)

Added jQuery UI (1.8) to core

Page 4: Changes to Drupal Themes in version 7 (part 1)

Stark is the new Zen

Based on Zen theme framework for Drupal.

Stark theme (new)

Plain white “vanilla” base theme.

CSS only sub-themes.

Page 5: Changes to Drupal Themes in version 7 (part 1)

The box.tpl.php template has been removed

( it’s about time )

Page 6: Changes to Drupal Themes in version 7 (part 1)

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

Page 7: Changes to Drupal Themes in version 7 (part 1)

The clear-block CSS class has been renamed to clearfix

Drupal 6.clear-block

Drupal 7.clearfix

Page 8: Changes to Drupal Themes in version 7 (part 1)

Search box moved from theme layer to blocks

Page 9: Changes to Drupal Themes in version 7 (part 1)

Primary and secondary links are now Main and Secondary menu

Drupal 6$primary_links

$secondary_links

Drupal 7$main_menu

$secondary_menu

Page 10: Changes to Drupal Themes in version 7 (part 1)

Unrendered taxonomy links variable gone in node.tpl.php

Drupal 6$taxonomy

Drupal 7$terms

Page 11: Changes to Drupal Themes in version 7 (part 1)

Remove $footer_message variable from page.tpl.php

remove $footer_message

Page 12: Changes to Drupal Themes in version 7 (part 1)

$help became a region.$help still used in page.tpl.php

Drupal 7 Theme .info file:

regions[help] = Help

Page 13: Changes to Drupal Themes in version 7 (part 1)

Mission statement removed, 'highlight' region suggested

Drupal 7 Theme .info file:

regions[highlight] = Highlight

Page 14: Changes to Drupal Themes in version 7 (part 1)

$content became a mandatory region

Drupal 7 Theme .info file:

regions[content] = Content

Page 15: Changes to Drupal Themes in version 7 (part 1)

$closure region becomes:

$page_bottom

$page_top

Page 16: Changes to Drupal Themes in version 7 (part 1)

$left and $right variables are now $sidebar_first and $sidebar_second; CSS IDs also changed

Page 17: Changes to Drupal Themes in version 7 (part 1)

Renamed $block->content to $content in block.tpl.php

Page 18: Changes to Drupal Themes in version 7 (part 1)

There are now two sets of variables process functions

preprocess

process

Page 19: Changes to Drupal Themes in version 7 (part 1)

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:

Page 20: Changes to Drupal Themes in version 7 (part 1)

All templates can print out dynamic attributes

$attributes

$title_attributes

$content_attributes

Page 21: Changes to Drupal Themes in version 7 (part 1)

Variable process functions can now be used for all theming hooks

Page 22: Changes to Drupal Themes in version 7 (part 1)

All theme functions now take a single argument

$variables

Page 23: Changes to Drupal Themes in version 7 (part 1)

Function names must match theme name

You may no longer use phptemplate_function

Page 24: Changes to Drupal Themes in version 7 (part 1)

CSS and JavaScript files must be specified in .info file

No more automatic style.css

No more automatic script.js

Page 25: Changes to Drupal Themes in version 7 (part 1)

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);  ?>

Page 26: Changes to Drupal Themes in version 7 (part 1)

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 ?>">

Page 27: Changes to Drupal Themes in version 7 (part 1)

More online

http://drupal.org/update/theme/6/7

http://tinyurl.com/theme-drupal

http://xtnd.us