Changes to Drupal Themes in version 7 (part 1)

8,090 views

Published on

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

Published in: Technology
0 Comments
15 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
8,090
On SlideShare
0
From Embeds
0
Number of Embeds
1,056
Actions
Shares
0
Downloads
257
Comments
0
Likes
15
Embeds 0
No embeds

No notes for slide

Changes to Drupal Themes in version 7 (part 1)

  1. 1. Drupal 7 Themes ( part 1 ) Chris Charlton - LA Drupal - XTND.US http://xtnd.us
  2. 2. Added jQuery 1.4 to core
  3. 3. Added jQuery UI (1.8) to core
  4. 4. Stark is the new Zen Based on Zen theme framework for Drupal. Stark theme (new) Plain white “vanilla” base theme. CSS only sub-themes.
  5. 5. The box.tpl.php template has been removed ( it’s about time )
  6. 6. Blocks have new, more meaningful CSS IDs Search form Old CSS ID (Drupal 6): #block-search-0 New CSS ID (Drupal 7): #block-search-form User login Old CSS ID (Drupal 6): block-user-0 New CSS ID (Drupal 7): block-user-login
  7. 7. The clear-block CSS class has been renamed to clearfix Drupal 6 .clear-block Drupal 7 .clearfix
  8. 8. Search box moved from theme layer to blocks
  9. 9. Primary and secondary links are now Main and Secondary menu Drupal 6 $primary_links $secondary_links Drupal 7 $main_menu $secondary_menu
  10. 10. Unrendered taxonomy links variable gone in node.tpl.php Drupal 6 $taxonomy Drupal 7 $terms
  11. 11. Remove $footer_message variable from page.tpl.php remove $footer_message
  12. 12. $help became a region. $help still used in page.tpl.php Drupal 7 Theme .info file: regions[help] = Help
  13. 13. Mission statement removed, 'highlight' region suggested Drupal 7 Theme .info file: regions[highlight] = Highlight
  14. 14. $content became a mandatory region Drupal 7 Theme .info file: regions[content] = Content
  15. 15. $closure region becomes: $page_bottom $page_top
  16. 16. $left and $right variables are now $sidebar_first and $sidebar_second; CSS IDs also changed
  17. 17. Renamed $block->content to $content in block.tpl.php
  18. 18. There are now two sets of variables process functions preprocess process
  19. 19. Templates have a variable for CSS classes: $classes_array <?php function mytheme_preprocess_node(&$vars) {   // Add an additional class.   $vars['classes_array'][] = 'new-class-to-add'; } ?> node.tpl.php: <div class="<?php print $classes ?>">   ... </div>
  20. 20. All templates can print out dynamic attributes $attributes $title_attributes $content_attributes
  21. 21. Variable process functions can now be used for all theming hooks
  22. 22. All theme functions now take a single argument $variables
  23. 23. Function names must match theme name You may no longer use phptemplate_function
  24. 24. CSS and JavaScript files must be specified in .info file No more automatic style.css No more automatic script.js
  25. 25. 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);   ?>
  26. 26. 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 ?>">
  27. 27. More online http://drupal.org/update/theme/6/7 http://tinyurl.com/theme-drupal http://xtnd.us

×